通过网上网友指点然后再再本地测试可以,最终发现是php版本问题,linux的环境是 php5.4.20,经过搜索找到解决方法了看下面.
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”.
因为php5.4的版本废除了session_register,所以需要去掉session_register函数,代码如下:
修改:“include/userlogin.class.php”,注释掉session_register,修改后如下:
//@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;
现象是发布英文标题没问题,发布中文会提示“标题不能为空”,因为htmlspecialchars在php5.4默认为utf8编码,gbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空,所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值.
解决方法:
1.在dede安装目录执行【linux环境】如下代码:
sed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`
2./include/common.func.php中任意位置添加函数,代码如下:
function gbkhtmlspecialchars($str)
{
return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');