php在传递参数为url时, 可以使用
- urlencode()编码
- urldecode()解码
示例代码
<?php
$v1 = "https://www.52dixiaowo.com/";
echo "原始的url是:".$v1."<br>";
$encode = urlencode($v1);
echo "编码后的值是:".$encode."<br>";
$decode = urldecode($encode);
echo "解码后的值是:".$decode."<br>";
?>
输出结果
原始的url是:https://www.52dixiaowo.com/
编码后的值是:https%3A%2F%2Fwww.52dixiaowo.com%2F
解码后的值是:https://www.52dixiaowo.com/
本篇完,还有疑问?留下评论吧