我有一个这样的形式:如何编码从html表单获取参数?
<form action="/web/" method="get">
<input type="search" name="keyword_search_query">
<input type="submit" value="Search…">
</form>
这是我的网站搜索表单。
将这些数据编码到搜索查询中以避免意外行为的正确/常用方法是什么?
例如,在其中一个输入中使用&
将切断搜索查询。我应该如何逃避这些角色?
P.S. Google如何做到这一点?
的可能的复制[如何正确URL编码在PHP中的字符串?](http://stackoverflow.com/questions/4744888/how-to-properly-url-encode-a -string-in-php) –