Home  >  Article  >  Backend Development  >  php ckeditor上传图片文件名乱码解决方法_php技巧

php ckeditor上传图片文件名乱码解决方法_php技巧

WBOY
WBOYOriginal
2016-05-17 08:52:53957browse

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

复制代码 代码如下:

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


后添加

复制代码 代码如下:

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


此处rand函数可根据需要自行改变重命名规则。
另一种上传图片文件名乱码解决方法为使用iconv函数对文件名进行编码转换,但仍然存在重名问题,所以针对Fckeditor上传图片文件名最好还是重命名
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn