Parse_url () function--parses the URL and returns its constituent parts
Array Parse_url (string $url, [$component])
This function parses a URL and returns an associative array containing the various components that appear in the URL
Parameters:
$url, the URL parameter to parse, invalid string with _ instead of
$component, designate,,,,,, PHP_URL_SCHEME PHP_URL_HOST PHP_URL_PORT PHP_URL_USER PHP_URL_PASS PHP_URL_PATHPHP_URL_QUERY 或 PHP_URL_FRAGMENT 的其中一个来获取 URL 中指定的部分的 string。 (除了指定为PHP_URL_PORT 后,将返回一个 integer 的值)
return value
For a severely unqualified URL,parse_url () may be returned FALSE .
If the argument is omitted component , an associative array of arrays is returned, at least one element is currently in the array. There are several possible keys in the array:
-
- scheme-such as HTTP
- host
- port
- user
- pass
- path
- query-After the question mark ?
- fragment-After the hash symbol #
If a parameter is specified component , parse_url () returns one string (or PHP_URL_PORT returns one when specified integer ) instead of an array. If the component specified in the URL does not exist, it will be returned NULL .
Cases
PHP Function---parse_url function