encro
2020-04-08 19:30:16 +08:00
评论里有:
Note:
pathinfo() is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the setlocale() function.
Reality:
var_dump(pathinfo('中国人 2016.xls'));
exit();
array(4) { 'dirname' => string(1) "." 'basename' => string(8) "2016.xls" 'extension' => string(3) "xls" 'filename' => string(4) "2016" }
Expect(Solve):
setlocale(LC_ALL, 'zh_CN.UTF-8');
var_dump(pathinfo('中国人 2016.xls'));
exit();
array(4) { 'dirname' => string(1) "." 'basename' => string(17) "中国人 2016.xls" 'extension' => string(3) "xls" 'filename' => string(13) "中国人 2016" }