php - 从浏览器读取 url

标签 php url

我有以下网址:http://raiffeisenclub.www4.nextsoft.at/# bereich=6&_suid=132023551036703093549711221371 我想通过 php 获取这个网址。我尝试过

$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

但我刚刚得到 http://raiffeisenclub.www4.nextsoft.at然后。还有

$_SERVER['QUERY_STRING']; 

$_SERVER['REQUEST_URI'];

不工作。 有人可以给我提示吗?

最佳答案

浏览器不会将哈希值(# 后面的部分)发送到服务器,因此它在 PHP 中不可用。您只需使用 JavaScript 即可读取它并将其发送到服务器

When a URI reference is used to perform a retrieval action on the identified resource, the optional fragment identifier, separated from the URI by a crosshatch ("#") character, consists of additional reference information to be interpreted by the user agent after the retrieval action has been successfully completed. As such, it is not part of a URI, but is often used in conjunction with a URI.

source

关于php - 从浏览器读取 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7980271/

相关文章:

php - 与多个较小的 SQL 相比,使用连接执行单个 SQL SELECT 是否更有效?

swift - 来自base64 url​​的数据

javascript - 是否可以为特定 URL 启用 javascript?

javascript - 替换 URL 中的任意单词

javascript - 不限制 id 属性来构建带有 anchor 的 URL

javascript - 如果没有 url 前缀 : www?,这个 js 会中断吗?

php - codeigniter 上的错误 Access-Control-Allow-Origin header

javascript - 在ubuntu中打开文件和下载不起作用

javascript - PHP 脚本不断以字符串形式返回数值

php - 法尔康 |对于 "belongsTo",一个查询代替两个查询