pathinfo 在中文出现在首字的时候不支持用 自己的函数搞定:
如 "C:/aa/vv/小学生.pdf"; 用pathinfo就会出问题
public function path_info($filepath)
{
$path_parts = array();
$path_parts ['dirname'] = rtrim(substr($filepath, 0, strrpos($filepath, '/')),"/")."/";
$path_parts ['basename'] = ltrim(substr($filepath, strrpos($filepath, '/')),"/");
$path_parts ['extension'] = substr(strrchr($filepath, '.'), 1);
$path_parts ['filename'] = ltrim(substr($path_parts ['basename'], 0, strrpos($path_parts ['basename'], '.')),"/");
return $path_parts;
}
本文介绍了一种处理中文路径信息的方法,通过自定义函数解决使用pathinfo时遇到的问题,适用于处理包含中文字符的文件路径。
302





