Home  >  Article  >  Backend Development  >  php URL encoding and decoding function code

php URL encoding and decoding function code

高洛峰
高洛峰Original
2017-01-03 17:52:421513browse

<?php 
$url = "http://www.php.cn"; 
echo urlencode($url); //输出编码后的字符串 
?>
<?php 
$url = "http://www.php.cn"; 
$newurl = urlencode($url); //首先对$url进行编码 
echo urldecode($newurl); //输出解码后的字符串 
?>

For more articles related to PHP URL encoding and decoding function codes, please pay attention to the PHP Chinese website!


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