If i request site/page.php#hash
the $_SERVER['REQUEST_URI']
is only /page.php
.
Is there a way to know in php (without later ajax) that the user requested the page with #hash
?
Thanks
Data: $_SERVER['REQUEST_URI'] Data type: String. Purpose: The URL path name of the current PHP file, including path-info and including URL query string.
$_SERVER['REQUEST_METHOD'] is one of the PHP server variables. It determines: Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
$_SERVER['PHP_SELF'] variable. This array element points out the filename of the currently executing script. For example, if you run www.cyberciti.biz/index.php, $_SERVER['PHP_SELF'] would be /index.
$_SERVER['SCRIPT_NAME'] is server-side. There are no browser compatibility issues as a result, and there shouldn't be security issues as it simply an indication of what the server is serving for the requested URL (i.e. http://example.com/ and http://example.com/index.php would both result in '/index.
Short answer: No.
The hash isn't passed to the server, it exists only on the client-side. This is by design. If the solution to your problem involves needing to know the hash server-side, you've chosen the wrong way to go about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With