The self-coding function solves the Chinese problem with the PathInfo () function.
Today to write the program encountered a small problem, pathinfo in the processing of Chinese file name problems, if the Chinese in the beginning of the word to get the filename is empty, English at the beginning of the word after the Chinese can be obtained. Such as:
So I wrote a function instead, the code is as follows:
Copy the Code code as follows:
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;
}
So the problem is solved.
http://www.bkjia.com/PHPjc/904917.html www.bkjia.com true http://www.bkjia.com/PHPjc/904917.html techarticle The self-function solves the PathInfo () function to handle the Chinese question, today writes the program to encounter a small problem, pathinfo in the processing Chinese file name the problem, if the Chinese in the word first appears to obtain ...