本文介绍了如何通过PHP获取page.html#PARAMETERS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取URL哈希的值(例如PARAMETERS在url page.html#PARAMETERS)在PHP上的服务器上?

How can I get the value of the URL hash (eg "PARAMETERS" in url "page.html#PARAMETERS") on the server in PHP?

推荐答案

你不能,至少不能直接。片段标识符永远不会发送到服务器。

You can't, at least not directly. The fragment identifier is never sent to the server.

您可以使用 location.hash 在JS中提取它,然后触发另一个HTTP请求到服务器,将其作为数据包含在内(例如在查询字符串中)。

You could extract it in JS using location.hash and then trigger another HTTP request to the server that includes it as data (e.g. in the query string).

这篇关于如何通过PHP获取page.html#PARAMETERS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 02:13