POST TIME:2017-11-13 00:47
今天把電腦上的phpStudy升級(jí)到2013版。在登錄本地織夢(mèng)dedecms5.7時(shí),/dede/login.php居然顯示空白。由于周五我安裝了windows8,因?yàn)槭请娔X問題,等我關(guān)掉防火墻配置好電腦服務(wù)后,發(fā)現(xiàn)還是不行。在百度后終于得到高人的日志指點(diǎn)。
原因很簡(jiǎn)單,phpstudy2013版是用的php5.4,而dedecms的login.php中使用了一個(gè)被php5.4拋棄不用的函數(shù)(是不是真的拋棄我不知道,反正原文這么寫的)
session_register()
意思就是這說(shuō)個(gè)函數(shù)不能用了,想用也用不了。方法很簡(jiǎn)單,直接注釋掉,不用進(jìn)行注冊(cè)就可以聲明session。
在dedecms目錄include/userlogin.class.php中查找
- functionkeepUser()
大概在281行,把keepUser()函數(shù)下的 @session_register(); 整段注釋掉(刪除也可以),結(jié)果如下:
- functionkeepUser()
- {
- 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();
- return1;
- }
- else
- {
- return-1;
- }
- }
另外的解決方法就是在include/userlogin.class.php 中聲明一個(gè)函數(shù)
- functionsession_register()
- {
- returntrue;
- }