Heim  >  Artikel  >  Backend-Entwicklung  >  php ckeditor上传图片文件名乱码解决方法_PHP教程

php ckeditor上传图片文件名乱码解决方法_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:49:02840Durchsuche

文件名乱码一般是中文导致的,因为ckeditor使用的是uft8编码如果我们页面使用的是gbk或gb2312就有可能出现乱码问题,解决办法只要对上传文件重命名即可。

打开editor/filemanager/connectors/php目录下commands.php,找到FileUpload函数,在

 代码如下 复制代码

$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;

后添加

$sFileName = rand(0,100).".".$sExtension;

此处rand函数可根据需要自行改变重命名规则。

另一种上传图片文件名乱码解决方法为使用iconv函数对文件名进行编码转换,但仍然存在重名问题,所以针对Fckeditor上传图片文件名最好还是重命名

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632759.htmlTechArticle文件名乱码一般是中文导致的,因为ckeditor使用的是uft8编码如果我们页面使用的是gbk或gb2312就有可能出现乱码问题,解决办法只要对上传文...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn