PHP get URL content [duplicate]

2019-08-30 06:42发布

问题:

This question already has an answer here:

  • Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)? 13 answers

I have a URL

http://localhost/ifocus/v3/services.php#nav-section2

I want to get hashtags from URL, EX : if the URL contains "#" so capture it via PHP

nav-section2

When i do

echo $_SERVER['REQUEST_URI'];

// Output
/ifocus/v3/services.php 

回答1:

You can't detect the hash parameter of the URL in PHP, you would need to use JavaScript.

You could make a jquery call to php which passes the hash data (window.location.hash) to a PHP script as a URL parameter and return TRUE/FALSE though.



回答2:

You can not capture this content for that you need js(client side script)



标签: php url