[英]URL encoding in PHP
我試圖查看提交表單時獲取參數的url編碼是否可行。 我已經看到了一些使用URL編碼的資源,這些URL是動態構建的
ex: www.google.com?query=urlencode($query)
但是,如果我使用表單和提交按鈕,該如何應用函數url編碼。
<html>
<body>
<form action="send.php" method="get">
<input type="input" name="method" value="" />
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>
瀏覽器將為您使用urlencode。 轉到Google並搜索“&”,然后您會在URL中看到“ q =%26”。
如果您要求瀏覽器完成此操作,請考慮使用enctype =“ application / x-www-form-urlencoded”
<html>
<body>
<form action="send.php" method="get" enctype="application/x-www-form-urlencoded">
<input type="input" name="method" value="" />
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>
請注意,如果您甚至不指定enctype,大多數現代瀏覽器默認都會完成此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.