简体   繁体   中英

Detect URL tags example.com/page.php#anycontent

How can I identify this type of tags:

example.com/file.php#inbox or example.com/another.php#spam

Like Gmail is detecting #inbox #spam #mycontent

I have tried with $_SERVER['REQUEST_URI'] but it does not work...

The hash part (everything after and including the # character) is not sent to the server. Only the client side (javascript) can read and use it.

The hash property can be requested from the Javascript location objects: location.hash .

If you want to pass data to a page, use GET parameters:

page.php?key=value

In PHP, you can use $_GET['key'] to retrieve value .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM