php basename()无法正确获取带中文字符的文件名

版权声明:如需转载,请标明出处。 https://blog.csdn.net/Tuine/article/details/83015617

原文链接:php basename()无法正确获取带中文字符的文件名

查看文档:

Note:

basename() is locale aware, so for it to see the correct basename with multibyte character paths, the matching locale must be set using the setlocale() function.

 

basename()函数依赖于区域,我们只需设置区域:

setlocale(LC_ALL, 'zh_CN.GBK');  

猜你喜欢

转载自blog.csdn.net/Tuine/article/details/83015617
今日推荐