|
|
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。
2 o% ^2 ~8 a7 W4 m8 x' P! \8 n1 m$ k$ i s' W5 n
1.解决dedecms登陆后台空白错误1 K1 n4 y4 r1 d
因为php5.5的版本废除了session_register,所以需要去掉session_register函数 k q# E- [9 h, T
/ V0 b5 W. R2 K% U) k/ H/ Y4 Q/ P
修改:“include/userlogin.class.php”,注释掉session_register,修改后如下
k) R' A9 F1 c$ J# Z, U( U: \9 X//@session_register($this->keepUserIDTag);$ Z1 h" u' c) o* |4 M: x
$_SESSION[$this->keepUserIDTag] = $this->userID;
; B* W+ Q0 e. S/ ?6 ^3 q: _
1 E7 f+ N+ Q* E8 n// @session_register($this->keepUserTypeTag);
; c5 q! T8 q& s6 y& ~$_SESSION[$this->keepUserTypeTag] = $this->userType;
1 V9 F( M" k9 |7 h: X& X- l1 U0 p8 r6 w& p
// @session_register($this->keepUserChannelTag);
; }; u! i. }7 c! J( H$_SESSION[$this->keepUserChannelTag] = $this->userChannel;
! J* C# _& L, ~! d. |9 w; i* _& M; }$ |2 _5 |, F: A* T6 q3 a+ |
// @session_register($this->keepUserNameTag);1 \: Q! h# o# _
$_SESSION[$this->keepUserNameTag] = $this->userName;
$ c3 h$ v" x. Y) z! X4 U+ W# G' u' k: {# q0 t5 h- d' l' i
// @session_register($this->keepUserPurviewTag);6 ~& X0 h# [* r
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;+ w) \' p! b& Y' Z
4 q: S/ D d+ @- a5 k+ v: J8 I
// @session_register($this->keepAdminStyleTag);
2 }/ u# h W' V3 @5 s$_SESSION[$this->keepAdminStyleTag] = $adminstyle;+ y% `$ t" M3 e$ d: G
: h' Z* S, B0 L/ v8 K3 I2.dedecms发布文章提示"标题不能为空"
3 d$ N. R3 ?6 N# E: N! q Z. C# s2 ~9 p9 }
现象是发布英文标题没问题,发布中文会提示“标题不能为空”- `7 r% V3 ^0 n+ T O7 V0 G
因为htmlspecialchars在php5.4默认为utf8编码,
$ |# {+ E' H+ H2 {8 `gbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。" I6 v8 s* j6 ~* }# s, W' V5 q
所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。
! V' Z6 N5 [. i. J& |0 A6 {0 L1 u
" k$ c8 C- p( m9 N0 x, Z具体方法:% X$ P8 G7 S B) p5 c
1.在dede安装目录执行
# X( \, g7 r- b2 Lsed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`1 w( M- f; Q0 r- r
7 I! }) I2 ^" d' x
2./include/common.func.php中任意位置添加函数0 y: B' a" Y1 m4 v
( B; [: t% p% n% k8 }( ` \ A
function gbkhtmlspecialchars($str)
~1 N1 Q% ]" U- @% a{: }, W! M- @# G3 ~
return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');
2 w/ Z( K! h; r# |- P; }8 I}
8 ~9 H" d: q/ f+ V5 b注意:使用了本文方法的就不用理会这篇文章了:http://bbs.swdyz.com/thread329sw1dyz1.shtml8 ^, s) l* \0 B: \: S( h
$ h% p) w2 I+ o' k |
|