关于双斜杠的问题

浏览:3524 发布日期:2013/01/29 分类:求助交流 关键字: URL 双斜杠问题
U命令使用中 如果URL_MODE = 0

在单斜杠下
http://test.mall.com/

string '/index.php?m=ceshi&a=ceshi' (length=27)
string '/index.php?m=ceshi&a=ceshi' (length=27)

在双斜杠下
http://test.mall.com//

string '//index.php?m=ceshi&a=ceshi' (length=27)
string '//index.php?m=ceshi&a=ceshi' (length=27)



如果 //index.php?m=ceshi&a=ceshi 出现在表单中 则会跳转到index.php的域名下 这样无法正确访问

现在修改Common/runtime.php中 第40行开始

 if(!defined('_PHP_FILE_')) {
        if(IS_CGI) {
            //CGI/FASTCGI模式下
            $_temp  = explode('.php',$_SERVER['PHP_SELF']);
            define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));
        }else {
            define('_PHP_FILE_',    rtrim($_SERVER['SCRIPT_NAME'],'/'));
        }
    }
修改为    if(!defined('_PHP_FILE_')) {
        if(IS_CGI) {
            //CGI/FASTCGI模式下
            $_temp  = explode('.php',$_SERVER['PHP_SELF']);
            define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));
        }else {
            $script_name = '/' . ltrim($_SERVER['SCRIPT_NAME'], '/');
            define('_PHP_FILE_', rtrim($script_name, '/'));
        }
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>