|
|
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。, y& d% t; f& B3 Z$ F" v% E$ m' N
8 @2 @, Y1 B6 H6 J% f* {3 T1.解决dedecms登陆后台空白错误
1 n! ^- i6 ^. a( G$ B% [因为php5.5的版本废除了session_register,所以需要去掉session_register函数( K; n9 m' c3 _8 C, U) O
* |$ S3 D5 |6 U4 ^6 g修改:“include/userlogin.class.php”,注释掉session_register,修改后如下1 c! o2 P g% k8 `
//@session_register($this->keepUserIDTag);
) a6 o. l) [5 a' |2 U$_SESSION[$this->keepUserIDTag] = $this->userID;
& ~1 \- h8 K6 z3 C; ^1 g2 C/ G2 M$ m8 O: L$ ~
// @session_register($this->keepUserTypeTag);3 }4 f! R+ h& }# r, [8 [
$_SESSION[$this->keepUserTypeTag] = $this->userType;
! _/ u- x! {9 w' t/ I& y* Z8 R5 F j0 k' ~' } Z
// @session_register($this->keepUserChannelTag);
( s: D$ n! _( _# y2 M$_SESSION[$this->keepUserChannelTag] = $this->userChannel;* v- W6 M; _9 C. g
4 X/ ~( i8 c4 { p5 p" q/ S+ T// @session_register($this->keepUserNameTag);
2 n+ g1 s7 U5 t* w* t" E9 Y$_SESSION[$this->keepUserNameTag] = $this->userName;
6 [: l4 r. L; v( \- m) t2 T7 Q
# m& D4 f8 C& t2 y- _1 ~// @session_register($this->keepUserPurviewTag);
4 n6 Q' i) v, r6 {$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;8 _$ g7 z8 c: z' T+ t6 q- J8 c
4 }$ s& P" y" G
// @session_register($this->keepAdminStyleTag);
( q. e2 ~* y, k: B; C/ Y$_SESSION[$this->keepAdminStyleTag] = $adminstyle;4 s0 C0 d L/ G
6 x/ Y! o* a( S( r' G5 @/ I, |
2.dedecms发布文章提示"标题不能为空"
# U2 X. l' B/ ?! e5 ?
( w% |- j( F) C7 D现象是发布英文标题没问题,发布中文会提示“标题不能为空”
6 K, `8 n6 t( E: e" ]& c3 e% O2 Q% Y/ Z因为htmlspecialchars在php5.4默认为utf8编码,
9 B6 z4 w) L: b5 G" Kgbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。, o+ @; O/ E6 x' x2 w
所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。
0 ?" Q* I) k% p5 W1 s* k: D& e" b8 d
具体方法:% k, {# j9 K9 b* Z! \3 _
1.在dede安装目录执行3 D6 c7 k9 L+ j2 @) B
sed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`! V0 L: C0 y* w) f2 D- Z
0 q' e: G/ R9 T! C
2./include/common.func.php中任意位置添加函数
9 @2 Z- n% V5 @
& S) G: l( j+ W3 Y; nfunction gbkhtmlspecialchars($str)$ v+ A2 r. [1 c2 ^
{
; C+ n$ ^1 z. |0 G' k6 ?6 b return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');
6 p9 h) j4 Q4 i}4 Y: d8 y b- s# z1 C
注意:使用了本文方法的就不用理会这篇文章了:http://bbs.swdyz.com/thread329sw1dyz1.shtml1 J' _3 N Q* g- m5 l1 m6 l
$ W# W# @. F& F3 i$ \: a1 M |
|