Home >Backend Development >PHP Tutorial >How to encrypt url in php? It's not particularly long.
How to encrypt url in php? It’s not particularly long
How to encrypt url in php? It’s not particularly long
urlencode
, not encryption
urlencode
I don’t know how you want to encrypt, is it like this? This is encoded with urlencode. Of course, it only parses Chinese characters and some special characters, such as plus signs and the like
www.xmy365.com/search/apachesolr_search/%5B %E9%87%91%E9%BE%99%E4%B9%A1%E6%9E%9C%E4%B8%9A%5D%20%E7%94%98%E8%82%83%E9%9D %99%E5%AE%81%E7%BA%A2%E5%AF%8C%E5%A3%AB%2012%E4%B8%AA%E7%9B%92(%E7%BA%A62.3kg)
If you pass url
as a parameter, it is recommended to use base64_encode
for encoding. At the same time, replace the unsafe characters
<code>//处理为URL安全模式 function reflowURLSafeBase64($str){ $str=str_replace("/","_",$str); $str=str_replace("+","-",$str); return $str; } //反解 function reflowNormalBase64($str){ $str=str_replace("_","/",$str); $str=str_replace("-","+",$str); return $str; }</code>