博客列表 >小鸟云虚拟主机Wordpress上传中文附件出现乱码

小鸟云虚拟主机Wordpress上传中文附件出现乱码

想无
想无原创
2021年10月27日 18:42:20429浏览

总结了小鸟云虚拟主机在使用过程中,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’);

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议