欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

自定义url变量转义方法

程序员文章站 2022-05-10 16:18:19
...
自定义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)!