PHP对URL进行字符串编码

urlencode($url1)

urldecode($url)
//对URL进行字符串编码和解码
$url1 = 'https://www.baidu.com/uploade/img/123.png';
echo $url1;
echo '
'; $url = urlencode($url1);//编码 输出https%3A%2F%2Fwww.baidu.com%2Fuploade%2Fimg%2F123.png echo $url; echo '
'; $url = urldecode($url);//解码 输出 https://www.baidu.com/uploade/img/123.png echo $url;

 

你可能感兴趣的:(PHP对URL进行字符串编码)