|
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。' A) z8 ?' J$ H1 C
5 m% u" Y$ z. D0 w6 ?1.解决dedecms登陆后台空白错误
) t; r* u2 u. i9 y因为php5.5的版本废除了session_register,所以需要去掉session_register函数7 `% O& y: d5 d; J3 N/ s- H6 t
' k4 T! w5 A/ f9 K修改:“include/userlogin.class.php”,注释掉session_register,修改后如下3 S" u* z7 f @3 d) A0 f. d) e2 H
//@session_register($this->keepUserIDTag);# O$ t/ e" h0 \( A
$_SESSION[$this->keepUserIDTag] = $this->userID;* R; G: R- c% `4 h8 V6 a$ \
5 F5 v2 T& y8 J& V/ w+ u( b
// @session_register($this->keepUserTypeTag);
% a6 Y4 |" ^% I$_SESSION[$this->keepUserTypeTag] = $this->userType;
0 P# C# R1 u* {9 x
9 g, G$ R* [* [7 o9 c9 i// @session_register($this->keepUserChannelTag);# _, V6 }+ J/ E& N
$_SESSION[$this->keepUserChannelTag] = $this->userChannel;
% ^7 t) E a9 e0 j" Q* t% J$ f+ O# D8 }3 {+ a
// @session_register($this->keepUserNameTag);
& ^/ P3 x- v* _) {! \$_SESSION[$this->keepUserNameTag] = $this->userName;
1 p `' S9 r9 L; T7 w
0 j3 z; P- t# |// @session_register($this->keepUserPurviewTag);( \! b7 |) a" N7 B
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;- d9 O; s- w% z" a
6 e( F8 \# U9 {" k* {& W: g// @session_register($this->keepAdminStyleTag);
! z p- K) q) Q+ v- y$_SESSION[$this->keepAdminStyleTag] = $adminstyle;- c( }2 \$ c6 X6 H r
8 h4 T1 i6 P7 W: b
2.dedecms发布文章提示"标题不能为空". R# `, t! J3 M% p' I
, _+ p. q4 j9 E3 T( t) d1 ]
现象是发布英文标题没问题,发布中文会提示“标题不能为空”
+ q$ b+ w O& c8 p. `! o因为htmlspecialchars在php5.4默认为utf8编码,, C! Y# S% k. T+ [& A
gbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。
$ S5 B( K' P- h2 S7 W所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。
! ^4 J }! V @( a4 a9 a/ S9 L. c2 I' z' a
具体方法:
5 B n; H" z* B6 ^1.在dede安装目录执行
. A( l& G: ^, D' Vsed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`! {3 D( B: t: z1 R Z1 o% W
. v3 \& ?' @$ P9 n7 x2./include/common.func.php中任意位置添加函数" u4 I a* q( y& ~
5 w/ s, S3 H6 k, G7 j
function gbkhtmlspecialchars($str)) i0 q' c7 a: j
{
: a* |8 ^+ o% @' Z6 K6 U& I return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');# v _) Y' ]' @/ B" D- m9 @
}
x( p. L: X1 c9 @注意:使用了本文方法的就不用理会这篇文章了:https://bbs.swdyz.com/thread329sw1dyz1.shtml, ?6 N6 W9 }, J' N0 j; j4 P3 j
" |- ], e8 ]9 I! n0 A7 E
|
|