Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_SERVER['REQUEST_URI'] with #hash too?

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

like image 641
dynamic Avatar asked Mar 21 '11 22:03

dynamic


People also ask

What is $_ SERVER [' Request_uri '] in PHP?

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.

What is $_ SERVER [' Request_method ']?

$_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'.

What is the $_ SERVER PHP_SELF variable explain with example?

$_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.

What is $_ SERVER [' Script_name ']?

$_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.


1 Answers

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.

like image 192
meagar Avatar answered Oct 12 '22 23:10

meagar