Php to get value of hash from URL

前端 未结 3 776
遇见更好的自我
遇见更好的自我 2020-12-11 20:50

How can I get a variable of a hash in php.

I have a variable on page like this

catalog.php#album=2song=1

How can i get the album an

3条回答
  •  情深已故
    2020-12-11 21:17

    Just adding onto @Alec's answer.

    There is a parse_url() function:

    Which can return fragment - after the hashmark #. However, in your case it will return all values after the hashmark:

    Array
    (
        [path] => catalog.php
        [fragment] => album=2song=1
    )
    

    As @NullUserException pointed out, unless you have the url beforehand this really is pointless. But, I feel its good to know nonetheless.

提交回复
热议问题