织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

使用phpstudy时dedecms后台页面空白解决方法(PHP版本原因)

织梦园模板 / 2019-01-03 / 收藏

今天把电脑上的phpStudy升级到2018版。在登录本地织梦dedecms5.7时,/dede/login.php居然显示空白。由于周五我安装了windows8,因为是电脑问题,等我关掉防火墙配置好电脑服务后,发现还是不行。在百度后终于得到高人的日志指点。

原因很简单,phpstudy2018版是用的php5.4,而dedecms的login.php中使用了一个被php5.4抛弃不用的函数(是不是真的抛弃我不知道,反正原文这么写的)

session_register()

意思就是这说个函数不能用了,想用也用不了。方法很简单,直接注释掉,不用进行注册就可以声明session。

在dedecms目录include/userlogin.class.php中查找

  1. function keepUser() 

大概在281行,把keepUser()函数下的 @session_register(); 整段注释掉(删除也可以),结果如下:

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

另外的解决方法就是在include/userlogin.class.php 中声明一个函数

  1. function session_register()   
  2. {  
  3. return true;  
  4. }  

相关织梦教程

收缩