Thinkphp 3.2.*路由重写BUG ,修正方法

xiaoxiao2021-02-28  21

找到文件:

盘符:\项目目录\ThinkPHP\Library\Think\Dispatcher.class.php

文件的119行(每个开发软件不同,大概在120行左右),截图如下:

替换成如下内容:

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') && !Route::check() && !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]:'';    }}

转载请注明原文地址: https://www.6miu.com/read-2650272.html

最新回复(0)