|
dedecms安装完成后会出现登陆后台空白,发布文章时提示”标题不能为空”。
{4 F8 \' f% u; a. o' B8 }0 c) c. H+ R- E+ h) n! {7 k
1.解决dedecms登陆后台空白错误4 l/ o; @" b/ |+ y$ D/ S0 F
因为php5.5的版本废除了session_register,所以需要去掉session_register函数
4 \: _+ |1 z2 U7 Y
, |3 w" z4 x' R( ]4 x修改:“include/userlogin.class.php”,注释掉session_register,修改后如下
2 D: b: {7 D" l9 T8 R' e//@session_register($this->keepUserIDTag);7 ]5 k6 z# U/ c+ s
$_SESSION[$this->keepUserIDTag] = $this->userID;( T2 s) W! s3 y8 w
o' M3 N- G9 y( {% C// @session_register($this->keepUserTypeTag);0 W2 T* n' y( u' v# h
$_SESSION[$this->keepUserTypeTag] = $this->userType;
. G. p4 g5 N8 ]# R8 h. S! F/ h3 ]) R) J
// @session_register($this->keepUserChannelTag);
7 N% ]8 J G2 {. y; [: b$_SESSION[$this->keepUserChannelTag] = $this->userChannel;2 h) z( W' K6 T8 p
# \3 u2 x+ R+ {3 z- t R& W// @session_register($this->keepUserNameTag);
5 q& D9 `( ]' r, @9 U4 w$_SESSION[$this->keepUserNameTag] = $this->userName;2 i2 B# g* D7 n! f" U( J# q
; r( P7 E: J: t' |
// @session_register($this->keepUserPurviewTag);2 x+ z" }" a' H% H2 W$ Q
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;9 \, d/ ]8 b* R$ z/ Y& C' |
* F, E5 I" c0 n3 ^' r; U- s// @session_register($this->keepAdminStyleTag);
; G! w! b8 E8 z3 q* T' X$_SESSION[$this->keepAdminStyleTag] = $adminstyle;( q7 t; ?. s! ?- M+ P
A' ?9 Q0 x9 e# R. S3 G2.dedecms发布文章提示"标题不能为空"$ Q# D" p3 O, M; b: K# W$ D6 I
. F, ?* @, D! d: n+ a9 A
现象是发布英文标题没问题,发布中文会提示“标题不能为空”: s8 O$ v& G( z7 K% Q! ^0 N3 ~
因为htmlspecialchars在php5.4默认为utf8编码,# v; Y& L% O8 e) T. P, h: w7 G
gbk编码字符串经 htmlspecialchars 转义后的中文字符串为空,也就是标题为空。1 C1 J) J# u4 ?/ @
所以给htmlspecialchars添加ENT_COMPAT ,'GB2312'参数修改编码默认值。% W- B1 U. n4 U( ~. M
# t# R: w( z% ]5 X) ?
具体方法:: I! y; } M0 W, w1 z9 R" Z7 ^
1.在dede安装目录执行
8 a( _. @: T2 a8 C% J- g2 Fsed -i "s/htmlspecialchars(/gbkhtmlspecialchars(/g" `grep htmlspecialchars\( -rl *`% b2 v8 B* L0 n7 e2 L( {# `
# e8 r4 t6 I8 j" Q: h
2./include/common.func.php中任意位置添加函数
; r+ b8 ?* g1 t# E: j# B. t
f( g6 M/ A+ hfunction gbkhtmlspecialchars($str)
. F$ B8 d+ G2 ^{
& d+ d% R' [- } return htmlspecialchars($str, ENT_COMPAT ,'ISO-8859-1');
% x( d" x/ G, e7 L8 J8 T}" x) O; Z" Q3 s+ N
注意:使用了本文方法的就不用理会这篇文章了:https://bbs.swdyz.com/thread329sw1dyz1.shtml
( _1 M* ]% q) |! a$ p4 e& n9 U r7 _
: R, b' H, ~ B9 x& b9 J9 A7 P |
|