无法从 URL PHP 获取以 # 开头的 id

2024-01-10

我正在尝试从 URL 中获取 id。

URL : http://localhost/user_notes/user.php?id=1234

echo $_GET['id']; // outputs 1234    

但是如果我使用#在 id 的开头,然后我没有得到 id。

URL : http://localhost/user_notes/user.php?id=#1234

echo $_GET['id']; // outputs nothing  

如果你想使用#作为 url 中的某些值,您需要使用 url 编码版本# i.e %23, 因为#表示指向页面某些部分的内部链接。看https://www.yourhtmlsource.com/text/internallinks.html https://www.yourhtmlsource.com/text/internallinks.html & https://way2tutorial.com/html/html_internal_links.php https://way2tutorial.com/html/html_internal_links.php

如果你的网址是http://localhost/user_notes/user.php?id=%231234,那么你会得到# in

echo $_GET['id'];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法从 URL PHP 获取以 # 开头的 id 的相关文章

随机推荐