登录本地织梦后台时出现空白,是因为PHP版本问题的解决办法
在打开织梦的时候有时候会出现空白的情况,今天以打开/dede/login.php空白为例看看怎么解决,归根结底是PHP版本的问题,参考了一些列百度答案找到解决办法。
phpstudy2018版是用的php5.4,而dedecms的login.php中使用了一个被php5.4抛弃不用的函数(是不是真的抛弃我不知道,反正原文这么写的)
session_register()
意思就是这说个函数不能用了,想用也用不了。方法很简单,直接注释掉,不用进行注册就可以声明session。
在dedecms目录include/userlogin.class.php中查找
- function?keepUser()
大概在281行,把keepUser()函数下的 @session_register(); 整段注释掉(删除也可以),结果如下:
- function?keepUser()
- {
- if($this->userID?!=?''?&&?$this->userType?!=?'')
- {
- global?$admincachefile,$adminstyle;
- if(emptyempty($adminstyle))?$adminstyle?=?'dedecms';
- //@session_register($this->keepUserIDTag);
- $_SESSION[$this->keepUserIDTag]?=?$this->userID;
- //@session_register($this->keepUserTypeTag);
- $_SESSION[$this->keepUserTypeTag]?=?$this->userType;
- //@session_register($this->keepUserChannelTag);
- $_SESSION[$this->keepUserChannelTag]?=?$this->userChannel;
- //@session_register($this->keepUserNameTag);
- $_SESSION[$this->keepUserNameTag]?=?$this->userName;
- //?@session_register($this->keepUserPurviewTag);
- $_SESSION[$this->keepUserPurviewTag]?=?$this->userPurview;
- //@session_register($this->keepAdminStyleTag);
- $_SESSION[$this->keepAdminStyleTag]?=?$adminstyle;
- PutCookie('DedeUserID',?$this->userID,?3600?*?24,?'/');
- PutCookie('DedeLoginTime',?time(),?3600?*?24,?'/');
- $this->ReWriteAdminChannel();
- return?1;
- }
- else
- {
- return?-1;
- }
- }
另外的解决方法就是在include/userlogin.class.php 中声明一个函数
- function?session_register()
- {
- return?true;
- }
注:上述方法主要将phpStudy升级至2018版为前提,进而考虑到可能是升级后版本的问题,期间也考虑过可能是电脑问题关闭防火墙以及配置好电脑服务一系列发现都没有用,遇到类似问题的童鞋也可以参考下。