retrieve the hash in the url with php?

后端 未结 5 2136
说谎
说谎 2020-12-10 17:14

someone here in SO told me that the hash (#) in the url could be retrieved by php function parse_url? is this true?

my web site got a lot of ajax effects and i want

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 17:42

    parse_url() can get the hash from a url string. Note the signature:

    mixed parse_url ( string $url [, int $component = -1 ] )
    

    You must already know the string. For instance, from the docs:

    
    

    Outputs

    Array
    (
        [scheme] => http
        [host] => hostname
        [user] => username
        [pass] => password
        [path] => /path
        [query] => arg=value
        [fragment] => anchor
    )
    /path
    

    Note the entry under key "fragment".

提交回复
热议问题