$_GET 调用 URL 时带或不带锚点的区别
$_GET difference when calling URL with or without anchor
如果我调用带锚点的 URL 与不带锚点相比,为什么 $_GET 会产生不同的结果?
示例:
https://www.myurl.com/#anchor?param1=x¶m2=y
如果我读取 GET 参数、REQUEST、$_SERVER['QUERY_STRING']、parse_url($url、PHP_URL_QUERY)
都是空的
但
https://www.myurl.com/?param1=x¶m2=y
一切如预期。
有人能给我解释一下吗?
锚点在最后,因此得名。 :)
https://www.myurl.com/?param1=x¶m2=y#anchor
Basically the hash component of the page URL (the part following the # sign) is processed by the browser only - the browser never passes it to the server. This sadly is part of the HTML standard and is the same whether or not you are using IE or any other browser (and for that matter PHP or any other server side technology).
Check the explanation from here.
如果我调用带锚点的 URL 与不带锚点相比,为什么 $_GET 会产生不同的结果?
示例:
https://www.myurl.com/#anchor?param1=x¶m2=y
如果我读取 GET 参数、REQUEST、$_SERVER['QUERY_STRING']、parse_url($url、PHP_URL_QUERY) 都是空的
但
https://www.myurl.com/?param1=x¶m2=y
一切如预期。
有人能给我解释一下吗?
锚点在最后,因此得名。 :)
https://www.myurl.com/?param1=x¶m2=y#anchor
Basically the hash component of the page URL (the part following the # sign) is processed by the browser only - the browser never passes it to the server. This sadly is part of the HTML standard and is the same whether or not you are using IE or any other browser (and for that matter PHP or any other server side technology).
Check the explanation from here.