原文链接: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.UTF8');