Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: PHP 可以读取 URL 的哈希部分吗?
是否可以在 PHP 中访问 URL 的哈希部分?
http://test.com/#thisisthehash
在 javascript 中可以使用window.location.hash
window.location.hash
不,这是不可能的。就在客户端是可能的。
HTTP 协议不传输此信息,因此服务器无法猜测它。
不,浏览器不会将其发送到服务器。一个肮脏的解决方法是通过 ajax 调用或其他方式将片段发送到服务器。