dirname (String path): gives a string containing a full path to a file, which returns the directory name after removing the file name. Both slash ( / ) and backslash (\) can be used as directory separators. In other environments, it is a slash ( / ).
DirName (http://www.sina.com.cn/abc/de/fg.php?id=1)//Return http://www.sina.com.cn/abc/de/
string basename (String path [, string suffix]): This function returns the base file name. If the file name is suffix ended, then this part will be removed as well.
BaseName ("http://www.sina.com.cn/abc/de/fg.php?id=1");//Return fg.php?id=1
BaseName ("http://www.sina.com.cn/abc/de/fg.php?id=1", '? id=1 ');//Return fg.php
array PathInfo (string path [, int options]): returns information about the file path, including the following array cells: dirname,basename and extension. The parameter options can be used to refer to the Decide which cells to return. They include: Pathinfo_dirname,pathinfo_basename and Pathinfo_extension. The default is to return all cells.
PathInfo ("http://www.sina.com.cn/abc/de/fg.php?id=1");
Return the following information
[DirName] = Http://www.sina.com.cn/abc/de
[BaseName] = fg.php?id=1
[Extension] = php?id=1
[FileName] = FG
string Realpath (String path): returns the normalized absolute pathname, used to pass in relative paths, returns No. /and./and redundant/absolute paths, which return FALSEon failure, for example, if the file does not exist
array parse_url (string url): resolves the URL and returns its components
Parse_url ("http://www.sina.com.cn/abc/de/fg.php?id=1");
Return the following information
[Scheme] = http
[Host] = www.sina.com.cn
[Path] =/abc/de/fg.php
[Query] = id=1
void Parse_str (String str [, array &arr]): mainly used to get the key value pairs of the parameters and corresponding values in the URL, if the second argument exists, the parsed string is stored as an element in this variable
$str = "First=value&arr[]=foo+bar&arr[]=baz";
Parse_str ($STR);
Echo $first; Value
echo $arr [0]; Foo Bar
echo $arr [1]; Baz
Parse_str ($str, $output);
echo $output [' first ']; Value
echo $output [' arr '][0]; Foo Bar
echo $output [' arr '][1]; Baz
Directory parsing functions in PHP