Wordpress上传中文附件出现乱码和后台上传中文图片不显示解决方法

2018-06-05 00:05:11 4637

Wordpress上传中文附件出现乱码和后台上传中文图片不显示解决方法


编辑wp-admin/includes/file.php这个文件


1、查找:

$new_file = $uploads['path'] . "/$filename";

替换为:

$new_file = $uploads['path'] . "/" . iconv("UTF-8","GB2312",$filename);

注意,之需要替换第一处即可!


2、查找

return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );

修改为:(修正中文文件名编码问题)

return apply_filters( 'wp_handle_upload', array( 'file' => $uploads['path'] . "/$filename", 'url' => $url, 'type' => $type ) , 'upload');


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: