首页 > PHP:没办法获取参数中的html编码值

PHP:没办法获取参数中的html编码值

URL:http://127.0.0.1/test.php?v=h

代码

<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<?php
    var_dump($_GET);
?>
</body>
</html>

结果:array(1) { ["v"]=> string(0) "" }


关键在于那个&符号让PHP把参数这么理解了v= & #x68,所以自然接受到的就是空了。切记url传参最好都做一次urlencode,而不是base64_encode

【热门文章】
【热门文章】