|
|
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。( R; f& a6 p2 @. u1 r% N
' \9 b, N* [* h6 L% E4 w, r1.解决dedecms登陆后台空白错误
: U# a. P" I. ?, X* O因为php5.5的版本废除了session_register,所以需要去掉session_register函数4 {0 m: v$ [0 e- I7 l/ F2 ^
& ~0 C+ `6 `% \" K修改:“include/userlogin.class.php”,注释掉session_register,修改后如下 H0 o& o! D4 Q) l# d
//@session_register($this->keepUserIDTag);
* U4 v' {7 B$ n ` L$_SESSION[$this->keepUserIDTag] = $this->userID;
! w6 q! [" S9 t O* s
4 x# y' z* p4 F9 U// @session_register($this->keepUserTypeTag);% v4 j+ u" l) y
$_SESSION[$this->keepUserTypeTag] = $this->userType;0 ~* \4 R; B- u# E i: l- Z% O, Y9 a4 \
, x+ h* s9 I8 z& T4 U) l
// @session_register($this->keepUserChannelTag);
/ t. _$ r1 K2 O7 @$_SESSION[$this->keepUserChannelTag] = $this->userChannel;+ g0 S# f2 g7 p
7 Y6 f, C- g' Y+ U3 X2 z: _+ N
// @session_register($this->keepUserNameTag);( `' E3 }( a4 K; h$ t
$_SESSION[$this->keepUserNameTag] = $this->userName;
1 J* m6 j$ l% C }9 X3 I% r* ?
9 F1 u. v) Z5 r6 U: Z0 M// @session_register($this->keepUserPurviewTag);
( S% X. H5 V# n$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;2 I, r' g. {; m5 `
0 a. N. P( Q7 K# u+ c
// @session_register($this->keepAdminStyleTag);
8 i3 i8 p4 t; T, z7 x$_SESSION[$this->keepAdminStyleTag] = $adminstyle;3 x$ O" a, M% \& c( @
0 g' G W* V% Y6 K: B
2.dedecms发布文章提示"标题不能为空"
. b/ p6 f3 ^ s q( p _. H4 n2 h l( P
现象是发布英文标题没问题,发布中文会提示“标题不能为空”
8 r, E% f) C v1 i* V/ r: i1 B8 e因为htmlspecialchars在php5.4默认为utf8编码,
$ Y5 z' x0 {8 Z: a* O3 Q3 Wgbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。. r2 n9 g4 O6 q
所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。* I9 b: f( O: M. N
; T: N* H7 g6 D% r% j) l! ]/ Y具体方法:
) }7 T0 C0 x0 }3 J4 R1.在dede安装目录执行
6 e6 |5 ]; G+ p3 u H0 Gsed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`
( A3 U& Q c8 ]% U! P' ^3 P0 \: `! m6 l8 f2 |8 t! B" `
2./include/common.func.php中任意位置添加函数! o3 N4 z1 G* {
I/ w* M3 ?& e/ P0 X0 Y5 o
function gbkhtmlspecialchars($str)
9 t+ V% t% b; k& Q, I: E{) Z% z7 y E. e/ [' p7 E8 h
return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');8 m, o' ~! O9 [- n" H& g# X' B
}1 D+ k5 h+ g M) n, s. ]
注意:使用了本文方法的就不用理会这篇文章了:http://bbs.swdyz.com/thread329sw1dyz1.shtml4 [3 B8 J3 u+ q" P
0 V$ e0 q! C! p# M |
|