thinkphp.5.1 上传保存为中文文件问题
程序员文章站
2022-03-01 18:13:32
...
参考文件 https://www.php.cn/blog/detail/1658.html
$path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; // 文件保存命名规则 $saveName = $this->buildSaveName($savename, $autoAppendExt); //http://phpshiti.com/article/110 //https://www.php.cn/blog/detail/1658.html if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $saveName = iconv('utf-8','gb2312//IGNORE', $saveName); }
//调用move()方法后,获取的中文文件名乱码 $info->getSaveName() 解决方法 //https://www.php.cn/blog/detail/1658.html $filename = $info->getSaveName(); $exclePath = iconv("GB2312","UTF-8", $filename);
( [title] => 第三法规库文件1.docx [size] => 7.13 [type] => docx [ext] => .docx [path] => \uploads\statute\第三法规库文件1.docx [role_id] => 8 )
下一篇: 关于敏捷开发,一个菜鸟程序猿有话说