简体   繁体   English

如何对URL参数进行Base64编码?

[英]How To Base64 Encode URL Params?

Example we have a form : 示例我们有一个形式:

<form action="" method="GET">
<input type="text" name="Search">
<input type="submit" value="Search">
</form>

if click on Search btn url will redirect to 如果点击搜索btn网址,则会重定向到

search.php?Search=parametr

how i can Encode This Parametr As Base64 ? 我如何将此参数编码为Base64?

search.php?Search=cGFyYW1ldHI=

It should be as simple as that . 应该就这么简单。 If you want to send the encoded parameter in the url you have to encode it before your html response. 如果要在url中发送编码参数,则必须在html响应之前对其进行编码。 Else this encoding makes no sense anyway. 否则,这种编码毫无意义。

$base64 = base64_encode($parameter); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM