今天把电脑上的phpStudy升级到2013版。在登录本地织梦dedecms5.7时,/dede/login.php居然显示空白。由于周五我安装了windows8,因为是电脑问题,等我关掉防火墙配置好电脑服务后,发现还是不行。在百度后终于得到高人的日志指点。 egH,7f(yP
原因很简单,phpstudy2013版是用的php5.4,而dedecms的login.php中使用了一个被php5.4抛弃不用的函数(是不是真的抛弃我不知道,反正原文这么写的) ].sD#~L_
session_register() p+0gE5
意思就是这说个函数不能用了,想用也用不了。方法很简单,直接注释掉,不用进行注册就可以声明session。 ^XG$?2<U
在dedecms目录include/userlogin.class.php中查找 ) I(9qt>Y
function keepUser() 5,-:31(j\
大概在281行,把keepUser()函数下的 @session_register(); 整段注释掉(删除也可以),结果如下: KzQFG)q ,
function keepUser() &%g$Bi,G
{ !yr4B"kz
if($this->userID != '' && $this->userType != '') fs-LaV
0
{ j<`3xd'
global $admincachefile,$adminstyle; 7SNdC8GZ~
if(emptyempty($adminstyle)) $adminstyle = 'dedecms'; FM(EOsWk
1yqsE`4f
//@session_register($this->keepUserIDTag); F1BXu@~e(
$_SESSION[$this->keepUserIDTag] = $this->userID; Z1:<i*6>D
\3"B$Sp|=
//@session_register($this->keepUserTypeTag); \m+=|
$_SESSION[$this->keepUserTypeTag] = $this->userType; EUVD)+it
=F}qT|K
//@session_register($this->keepUserChannelTag); r=SCbv
$_SESSION[$this->keepUserChannelTag] = $this->userChannel; o|q5eUh=EY
b)M-q{
//@session_register($this->keepUserNameTag); !uO@4]:Y
$_SESSION[$this->keepUserNameTag] = $this->userName; u;!h
4_sJ0 =z-
// @session_register($this->keepUserPurviewTag); 0
f$96sl
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview; R4P&r=?
R9Wr?
//@session_register($this->keepAdminStyleTag); oylQCbT
$_SESSION[$this->keepAdminStyleTag] = $adminstyle; *W`7JL,
aXG|IN5 *m
PutCookie('DedeUserID', $this->userID, 3600 * 24, '/'); [CfZE
PutCookie('DedeLoginTime', time(), 3600 * 24, '/'); =S\^j"
Ge=^q.
$this->ReWriteAdminChannel(); ^Ifm1$X}
cWZ uph\
return 1; Mis B&Ok`k
} oXqJypR 2
else ^Y;,cLXJ
{ ~piE$"]&
return -1; M!mw6';k
} s!
} wIR"!C>LE
另外的解决方法就是在include/userlogin.class.php 中声明一个函数