在后台上传商品图片的时候,如果你选择一个中文名称的图片,那么上传后会产生乱码,导致图片显示不出来。; p9 \; p n5 ^$ y( f
) I' s1 n1 F$ J0 e
下面说一种解决办法:5 e, p/ h6 J+ ]% t% b
使用“年月日时分秒 + 6个随机字符”做为文件名,如 20101016135632jusv3x.jpg6 l! D& @ P8 x1 [5 [5 J7 T
' f2 q6 h4 y& w5 A打开文件 \includes\fckeditor\editor\filemanager\connectors\php\commands.php
" h9 p# u; W! [4 W7 P找到 + t4 d- z3 v) Y) Y8 w9 l
$sFileName = $oFile['name'] ;
+ B. x- R W, y$ P0 P }修改为$string = 'abcdefghijklmnopqrstuvwxyz0123456789';0 W1 T: C+ q0 G
$rand = '';6 @+ ^5 U. M2 ~
for ($x=0;$x<6;$x++){& }5 L' X# l2 x
mt_srand();+ Y; n3 ` l3 P7 U. M# Z* y
$rand.= substr($string,mt_rand(0,strlen($string)-1),1);9 q2 B. _, I+ ]; x
}
) R, k4 S9 J: o $sFileName = date('YmdHis').$rand.".".strtolower(array_pop(explode(".",$oFile['name']))); | / Q8 |- Q) g: r) W0 l& I
|