首页 >php教程 >PHP源码 >自定义url变量转义方法

自定义url变量转义方法

PHP中文网
PHP中文网原创
2016-05-23 17:09:461538浏览

自定义url变量转义方法

thinkphp等系统专用,url传递的参数不能带有/等特殊字符

function base_encode($str) {

    $src  = array("/","+","=","?","&");

    $dist = array("_.a._","_.b._","_.c._","_.d._","_.e._");



    $new  = str_replace($src,$dist,$str);

    return $new;

}

function base_decode($str) {

        $src = array("_.a._","_.b._","_.c._","_.d._","_.e._");

        $dist  = array("/","+","=","?","&");

        $new  = str_replace($src,$dist,$str);

        return $new;

}

                   

 以上就是自定义url变量转义方法的内容,更多相关内容请关注PHP中文网(www.php.cn)!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn