PHP Function---parse_url function

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.