nginx $_SERVER['PHP_SELF'] 重複路徑

場景:php

    windows :linux

        $_SERVER['PHP_SELF']        /index.php/module/controller/actionwindows

    linux : __ACTION__獲取路徑重複code

        $_SERVER['PHP_SELF']        /index.php/module/controller/action/module/controller/actionio

定位:class

    ThinkPHP/ThinkPHP.php第82行:module

if(!IS_CLI) {
    // 當前文件名
    if(!defined('_PHP_FILE_')) {
        if(IS_CGI) {
            //CGI/FASTCGI模式下
            //$_temp  = explode('.php',$_SERVER['PHP_SELF']);
            //改成
            $_temp  = explode('.php',$_SERVER['SCRIPT_NAME']);
            define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));
        }else {
            define('_PHP_FILE_',    rtrim($_SERVER['SCRIPT_NAME'],'/'));
        }
    }
}
相關文章
相關標籤/搜索