Possible Duplicates:
How to obtain anchor part of URL after # in php
Is it possible to access anchors in a querystring via PHP?
我需要找到一种方法来做到这一点,Facebook 做到了,所以它必须是可能的......
如果用户在浏览器中访问此 URL
http://localhost/index.php?photos=p# 12345
然后我可以让 PHP 从 mysql 加载 ID 为 12345 的照片
如果用户访问
http://localhost/index.php?photos=p# 123456
然后它会加载 id 123456
我只需要帮助获取 URL 中 # 后面的值,并在可能的情况下使用 PHP 访问它?如果不可能,那么我也许可以使用 jQuery 访问它,然后进行 AJAX 调用以根据该值加载图像。
那么有人知道我如何获得这个值吗?
最佳答案
您可以使用
在 Javascript 中获取哈希值document.location.hash
关于php - 如何访问 URL 中 # 后面的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2072544/