ThinkPHP 3.2.2 重寫BUG ,修正方法

來源:互聯網
上載者:User

標籤:thinkphp   bug   

TP3.2.x問題真多,官網根本就不維護了,很多時候TP官網都根本無法下載TP。

一個很嚴重的BUG,網址重寫無法支援原因ThinkPHP本來就根本執行順序全錯


解決方案:

檔案:

#D:\PC\zbphp.com\ThinkPHP\Library\Think\Dispatcher.class.php


代碼:(替換成下面的即可 by default7#zbphp.com)

        if(empty($_SERVER['PATH_INFO'])) {            $_SERVER['PATH_INFO'] = '';            define('__INFO__','');            define('__EXT__','');        }else{            Route::check(); //add by default7#zbphp.com            define('__INFO__',trim($_SERVER['PATH_INFO'],'/'));            // URL尾碼            define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));            $_SERVER['PATH_INFO'] = __INFO__;                 if (__INFO__ && !defined('BIND_MODULE') && C('MULTI_MODULE') && empty($_GET)){ // 擷取模組名                $paths      =   explode($depr,__INFO__,2);                $allowList  =   C('MODULE_ALLOW_LIST'); // 允許的模組列表                $module     =   preg_replace('/\.' . __EXT__ . '$/i', '',$paths[0]);                if( empty($allowList) || (is_array($allowList) && in_array_case($module, $allowList))){                    $_GET[$varModule]       =   $module;                    $_SERVER['PATH_INFO']   =   isset($paths[1])?$paths[1]:'';                }            }                           }


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.