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]:''; } } }
ThinkPHP 3.2.2 重写BUG ,修正方法,布布扣,bubuko.com
原文地址:http://blog.csdn.net/default7/article/details/38338071