构建查询字符串
程序员文章站
2022-04-10 12:50:04
...
跳至
[1]
[全屏预览]
'this is a name', 'color' => 'red', 'favorite_punctuation' => '#'); $query_str = http_build_query($vars); $url = '/test/test.php?' . $query_str; echo $url."\n"; $url = '/test/test.php?' . htmlentities($query_str); echo $url."\n"; 输出结果: /test/test.php?name=this+is+a+name&color=red&favorite_punctuation=%23 /test/test.php?name=this+is+a+name&color=red&favorite_punctuation=%23 ~ ~