我有以下网址: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.
关于php - 从浏览器读取 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7980271/