php【基础学习八】URL编解码

<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2015/12/25
 * Time: 17:19
 */


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

你可能感兴趣的:(php【基础学习八】URL编解码)