Home > Backend Development > PHP Tutorial > 为啥不能获取URL中的&后面的参数

为啥不能获取URL中的&后面的参数

WBOY
Release: 2016-06-13 11:49:14
Original
1167 people have browsed it

为什么不能获取URL中的&后面的参数。
页面的URL是这样的:
page1.php?mod=aa&id=1
用_Get['mod']可以获取到aa.
但是用Get['id']却是空。
如何才能在php中获取到id参数那?
谢谢。
------解决方案--------------------
你的url得不到id的那个参数的,你得把&转换成&
也就是说你需要把
page1.php?mod=aa&id=1变为page1.php?mod=aa&id=1

&等价于&但在url中不会识别
------解决方案--------------------
 '&' (ampersand) becomes '&' 
使用htmlspecialchars_decode()
------解决方案--------------------
print_r($_GET);
Array
(
    [mod] => aa
    [amp;id] => 1
)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template