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.

WBOY
Release: 2016-09-27 14:18:10
Original
1307 people have browsed it

How to encrypt url in php? It’s not particularly long

Reply content:

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template