PHP & Hash / Fragment Portion of URL

前端 未结 5 854
北恋
北恋 2020-12-03 08:42

I am trying to find a way to save the hash portion of a url and as a PHP variable. This idea is a bit kooky, but bear with me...

I\'d like to extract the \"location

5条回答
  •  眼角桃花
    2020-12-03 09:35

    It's contained in the "fragment" value returned from PHP's parse_url function.

    From PHP manual:

    
    

    Will return:

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

提交回复
热议问题