retrieve the hash in the url with php?

后端 未结 5 2149
说谎
说谎 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:54

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

    Yes:

    parse_url('http://stackoverflow.com/questions/1957030/retrieve-the-hash-in-the-url-with-php/1957040#1957040', PHP_URL_FRAGMENT); // 1957040
    

    But you can't determine the hash on the server side without knowing the full URL à priori, not sure if the HTTP_REFERER holds this hash (think not).

提交回复
热议问题