看下面两句话:

$path_parts = pathinfo($filename);$title = $path_parts['filename'];

在如果文件名是GBK、GB2312等非UTF-8或ASCI字符集编码时,获取的filename属性是错误的。
因此,如果要获取争取的属性,应当先对字符集进行编码。

$filename = transToUTF8($filename); $path_parts = pathinfo($filename);$title = $path_parts['filename'];