在后台上传商品图片的时候,如果你选择一个中文名称的图片,那么上传后会产生乱码,导致图片显示不出来。

下面说一种解决办法:
使用“年月日时分秒 + 6个随机字符”做为文件名,如 20101016135632jusv3x.jpg

打开文件 \includes\fckeditor\editor\filemanager\connectors\php\commands.php
找到
$sFileName = $oFile['name'] ;
修改为
$string = 'abcdefghijklmnopqrstuvwxyz0123456789';
$rand = '';
for ($x=0;$x<6;$x++){
mt_srand();
$rand.= substr($string,mt_rand(0,strlen($string)-1),1);
}
$sFileName = date('YmdHis').$rand.".".strtolower(array_pop(explode(".",$oFile['name'])));

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2021-12-15
  • 2021-05-16
  • 2022-12-23
  • 2022-01-18
  • 2021-08-27
  • 2022-12-23
相关资源
相似解决方案