解决办法:
找到include/userlogin.class.php,里面有一个keepuser()函数,它是用session_register来注册一个session变量,但是在php5.4中已经移除了这个功能,见官网介绍:
如果使用的该php版本肯定会出错的,不过我们可以修改下代码:
把@session_register($this->keepUserIDTag); 注释掉,然后改为
if (!isset($_SESSION[$this->keepUserIDTag]))
一共有六个,全部改为下面这样:
01 |
if (!isset($_SESSION[$this->keepUserIDTag])) |
02 |
//@session_register($this->keepUserIDTag); |
03 |
$_SESSION[$this->keepUserIDTag] = $this->userID; |
04 |
if (!isset($_SESSION[$this->keepUserTypeTag])) |
05 |
//@session_register($this->keepUserTypeTag); |
06 |
$_SESSION[$this->keepUserTypeTag] = $this->userType; |
07 |
if (!isset($_SESSION[$this->keepUserChannelTag])) |
08 |
//@session_register($this->keepUserChannelTag); |
09 |
$_SESSION[$this->keepUserChannelTag] = $this->userChannel; |
10 |
if (!isset($_SESSION[$this->keepUserNameTag])) |
11 |
//@session_register($this->keepUserNameTag); |
12 |
$_SESSION[$this->keepUserNameTag] = $this->userName; |
13 |
if (!isset($_SESSION[$this->keepUserPurviewTag])) |
14 |
//@session_register($this->keepUserPurviewTag); |
15 |
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview; |
16 |
if (!isset($_SESSION[$this->keepAdminStyleTag])) |
17 |
//@session_register($this->keepAdminStyleTag); |
18 |
$_SESSION[$this->keepAdminStyleTag] = $adminstyle; |
|
重新进入后台登录,就可以正常跳转到管理页面了。
因为对PHP并不熟,网上一般都说是data/common.inc.php文件编码的问题,把编码要改为无BOM格式文件保存,居然没有说是php5.4版本的问题
另外一种方法:
在include/helpers/util.helper.php末尾加入以下代码
01 |
function fix_session_register(){ |
02 |
function session_register(){ |
03 |
$args = func_get_args(); |
04 |
foreach ($args as $key){ |
05 |
$_SESSION[$key]=$GLOBALS[$key]; |
08 |
function session_is_registered($key){ |
09 |
return isset($_SESSION[$key]); |
11 |
function session_unregister($key){ |
12 |
unset ($_SESSION[$key]); |
15 |
if (!function_exists( 'session_register' )) fix_session_register(); |
|
这样php5.4下dedecms就能正常使用了。