thinkphp.5.1 上传保存为中文文件问题
程序员文章站
2022-03-06 13:22:09
...
参考文件 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 )
上一篇: thinkphp6 上传文件
下一篇: tp6 session 扩展 redis