Home >Backend Development >PHP Tutorial >php is similar to uriEncode in JS

php is similar to uriEncode in JS

WBOY
WBOYOriginal
2016-08-08 09:30:13880browse

     

Do not encode special characters in URI

$str = ';/?:@&=+$,#';
$urlencode = "%3B %2F %3F %3A %40 %26 %3D %2B % 24 %2C %23";

str_replace(array('%3A','%2F','%40','%3F','%3D','%26','%23','% 25','%3B','%2B','%24','%2C'), array(':','/','@','?','=','&', '#','%',';','+','$',','),$uri);

The above introduces how PHP is similar to uriEncode in JS, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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