Phpparse_url function tutorial. Phpparse_url function tutorial parse_url (PHP4, PHP5) parse_url-parse the URL and return its component description mixed parse_url (string $ URL [Summary $ part-1]) php parse_url function tutorial
Parse_url
(PHP 4 and PHP 5)
Parse_url-parse the URL and return its components
Description
Hybrid parse_url (string $ URL [Abstract $ part =-1])
This function parses a URL and returns a URL with an associated array containing all components. There are also differences.
This function does not mean to verify the given url. it not only breaks the above section of it. Some URLs are also accepted, and parse_url () will try to parse them correctly as much as possible.
Parameters
URL
URL resolution. Invalid character substitution _.
Part
Specify a PHP_URL_SCHEME, PHP_URL_HOST, PHP_URL_PORT, PHP_URL_USER, PHP_URL_PASS, PHP_URL_PATH, PHP_URL_QUERY, or PHP_URL_FRAGMENT to retrieve a specific URL as a string.
Return value
For URL with severe malformed state, parse_url () may return FALSE and issue E_WARNING. Otherwise, the elements returned by the associated array may be (at least one ):
Plan-such as web site
Master
Port
User
Pass
Path
Question mark after query?
Segment-Post hashmark #
If some parameters specify to return a string rather than an array.
Modify
Version description
5.1.2 time element parameters
Instance
$ Url = 'http: // username: password @ hostname/path? Arg = value # anchor ';
Print_r (parse_url ($ url ));
Echo parse_url ($ url, PHP_URL_PATH );
?>
The above example will output:
Array
(
[Scheme] => http
[Host] => hostname
[User] => username
[Pass] => password
[Path] =>/path
[Query] => arg = value
[Fragment] => anchor
)
/Path
Http://www.bkjia.com/PHPjc/445463.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445463.htmlTechArticlephp parse_url function tutorial parse_url (in PHP 4, in PHP 5) parse_url-parse the URL and return its component description mixed parse_url (string $ URL [Summary $ Section =-1]) this task...