原文来自:https://www.zixuephp.com

php5.4 织梦dedecms后台登录空白问题

有不少喜欢尝新的朋友会碰服务器安装php5.4版本之后dedecms5.7登录后面一篇白茫茫的啊,像下雪一样,下面我们来看dedecms后台登录空白问题问题办法.

linux,php5.4,织梦dedecms后台登录空白.

原因:include/userlogin.class.php,里面有一个keepuser()函数,是用session_register来注册一个session变量,但是在php5.4中已经移除了这个功能,代码如下:

把:@session_register($this->keepUserIDTag);注释掉,然后改为:

if (!isset($_SESSION[$this->keepUserIDTag]))

如下:

if (!isset($_SESSION[$this->keepUserIDTag]))

//@session_register($this->keepUserIDTag);

我的修改前与修改后的代码.

解决方法:找开include/userlogin.class.php文件.查找以下内容:

  1. @session_register($this->keepUserIDTag);
  2. $_SESSION[$this->keepUserIDTag]=$this->userID;
  3. @session_register($this->keepUserTypeTag);
  4. $_SESSION[$this->keepUserTypeTag]=$this->userType;
  5. @session_register($this->keepUserChannelTag);
  6. $_SESSION[$this->keepUserChannelTag]=$this->userChannel;
  7. @session_register($this->keepUserNameTag);
  8. $_SESSION[$this->keepUserNameTag]=$this->userName;
  9. @session_register($this->keepUserPurviewTag);
  10. $_SESSION[$this->keepUserPurviewTag]=$this->userPurview;
  11. @session_register($this->keepAdminStyleTag);
  12. $_SESSION[$this->keepAdminStyleTag]=$adminstyle;
  13. PutCookie(‘DedeUserID’,$this->userID,3600*24,‘/’);
  14. PutCookie(‘DedeLoginTime’,time(),3600*24,‘/’);
  15. 替换成
  16. global$admincachefile,$adminstyle;
  17. if(emptyempty($adminstyle))$adminstyle=‘dedecms’;
  18. //@session_register($this->keepUserIDTag);
  19. $_SESSION[$this->keepUserIDTag]=$this->keepUserIDTag;
  20. $_SESSION[$this->keepUserIDTag]=$this->userID;
  21. //@session_register($this->keepUserTypeTag);
  22. $_SESSION[$this->keepUserTypeTag]=$this->keepUserTypeTag;
  23. $_SESSION[$this->keepUserTypeTag]=$this->userType;
  24. //@session_register($this->keepUserChannelTag);
  25. $_SESSION[$this->keepUserChannelTag]=$this->keepUserChannelTag;
  26. $_SESSION[$this->keepUserChannelTag]=$this->userChannel;
  27. //@session_register($this->keepUserNameTag);
  28. $_SESSION[$this->keepUserNameTag]=$this->keepUserNameTag;
  29. $_SESSION[$this->keepUserNameTag]=$this->userName;
  30. //@session_register($this->keepUserPurviewTag);
  31. $_SESSION[$this->keepUserPurviewTag]=$this->keepUserPurviewTag;
  32. $_SESSION[$this->keepUserPurviewTag]=$this->userPurview;
  33. //@session_register($this->keepAdminStyleTag);
  34. $_SESSION[$this->keepAdminStyleTag]=$this->keepAdminStyleTag;
  35. $_SESSION[$this->keepAdminStyleTag]=$adminstyle;
  36. PutCookie(‘DedeUserID’,$this->userID,3600*24,‘/’);
  37. PutCookie(‘DedeLoginTime’,time(),3600*24,‘/’);