找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10956|回复: 0

dedecms(织梦)发布文章提示"标题不能为空"及与php5.5兼容问题的解决

[复制链接]
发表于 2014-8-9 11:03:07 | 显示全部楼层 |阅读模式
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。
) d, H3 i" [- {) a8 V0 T* M, ]( r, @; b+ K# c9 P/ O$ q; J
1.解决dedecms登陆后台空白错误
: V( z% b8 p& ]0 F% A  n因为php5.5的版本废除了session_register,所以需要去掉session_register函数% B+ I7 Q+ C: l& O  n5 k2 D

) R/ c0 H" G" Q) Y4 p修改:“include/userlogin.class.php”,注释掉session_register,修改后如下
3 C7 K, L* G, [1 J//@session_register($this->keepUserIDTag);
7 E+ ~! I& ]* p$_SESSION[$this->keepUserIDTag] = $this->userID;3 C! ^. G. m( p

$ H2 [0 Z" s1 k% v; F// @session_register($this->keepUserTypeTag);) T, d' ?4 F) B, s
$_SESSION[$this->keepUserTypeTag] = $this->userType;, M( m- X" k$ j0 n) x: b6 v3 M; w

; W4 D' n) g# I. e5 \// @session_register($this->keepUserChannelTag);
6 P! Y. z+ J, q1 u7 O- g; P; g$_SESSION[$this->keepUserChannelTag] = $this->userChannel;4 n- T' o& L8 J3 P& V

6 `/ N# \6 U% ]& N/ n4 ~: ~// @session_register($this->keepUserNameTag);
! b( X# R+ I1 Z' q/ F8 k7 @$_SESSION[$this->keepUserNameTag] = $this->userName;' f6 s7 f7 w/ x; ~  g1 U( c

, ^# e0 E: w8 s// @session_register($this->keepUserPurviewTag);
! W1 Y: f' ~, ]7 s8 R' }$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;2 _8 u! t9 H2 A

2 p* h# r" o- h2 w7 V% p// @session_register($this->keepAdminStyleTag);8 R" z. }/ w) `. ~
$_SESSION[$this->keepAdminStyleTag] = $adminstyle;
" r4 A9 d3 z/ k, l% M
' c) `# X/ @# V2.dedecms发布文章提示"标题不能为空"; y/ L6 N. h. ~8 Q3 ~5 ^' X  ^& L

, }5 Y* W  Q$ F+ k0 A* C现象是发布英文标题没问题,发布中文会提示“标题不能为空”  O) A& U, G3 I8 y' A# r$ D( U/ N/ R
因为htmlspecialchars在php5.4默认为utf8编码,
6 [' d, Z! a; V3 pgbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。* g# R+ N0 ~9 w% F3 W# [
所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。# D7 l  x  U% O1 N- H3 T, L. y7 P
2 i+ y- s1 F8 n
具体方法:3 t! D1 p, K( k, U; Q& l- J
1.在dede安装目录执行
& A  I3 D/ L' l9 u( A& h* ^sed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`
* I+ A' M# {) ]: f) h8 R  K3 `8 t, v3 [1 ?5 ~1 _) i
2./include/common.func.php中任意位置添加函数
7 {4 a. q5 P& e- P
5 l0 U" R, P1 `2 Ffunction gbkhtmlspecialchars($str)% Z3 e" q2 \' o+ _7 D1 Y
{
# D5 V6 M2 |* G* Y8 V        return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');  z4 O- ^4 s0 w& ?% B; |* `; |
}* ~: U$ U& P' p
注意:使用了本文方法的就不用理会这篇文章了:http://bbs.swdyz.com/thread329sw1dyz1.shtml+ N% W7 H# H4 b3 d
4 l" ^$ u  w3 K6 s
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2026-6-25 11:14 , Processed in 0.063439 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表