From 5c86723d024a4ea04efcd3dfb544e9e304c9d0f6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 22 Jan 2015 08:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96mvc=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Think/App.php | 6 +++--- Library/Think/Loader.php | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Library/Think/App.php b/Library/Think/App.php index 94105879..8a69f663 100644 --- a/Library/Think/App.php +++ b/Library/Think/App.php @@ -212,11 +212,11 @@ class App { // URL后缀 define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION))); $_SERVER['PATH_INFO'] = __INFO__; - if(!defined('BIND_MODULE')){ - if($config['url_deny_suffix'] && preg_match('/\.('.$config['url_deny_suffix'].')$/i', $_SERVER['PATH_INFO'])){ + if(__INFO__ && !defined('BIND_MODULE')){ + if($config['url_deny_suffix'] && preg_match('/\.('.$config['url_deny_suffix'].')$/i', __INFO__)){ exit; } - $paths = explode($config['pathinfo_depr'], $_SERVER['PATH_INFO']); + $paths = explode($config['pathinfo_depr'], __INFO__,2); // 获取URL中的模块名 if($config['require_module'] && !isset($_GET[$config['var_module']])) { $_GET[$config['var_module']] = array_shift($paths); diff --git a/Library/Think/Loader.php b/Library/Think/Loader.php index f9ad45e9..f5e077a6 100644 --- a/Library/Think/Loader.php +++ b/Library/Think/Loader.php @@ -33,7 +33,6 @@ class Loader { $path = APP_PATH; } $filename = $path . str_replace('\\', '/', str_replace('\\_','\\',strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $class), "_")))) . EXT; - var_dump($filename); if(is_file($filename)) { include $filename; } @@ -138,8 +137,7 @@ class Loader { }else{ $module = MODULE_NAME; } - $layer = ucwords($layer); - $class = $module . '\\' . $layer . '\\' . parse_name($name, 1). $layer; + $class = $module . '\\' . $layer . '\\' . parse_name($name, 1); if(class_exists($class)) { $model = new $class($name); }else { @@ -166,14 +164,13 @@ class Loader { }else{ $module = MODULE_NAME; } - $layer = ucwords($layer); - $class = $module . '\\' . $layer . '\\' . parse_name($name, 1) . $layer; + $class = $module . '\\' . $layer . '\\' . parse_name($name, 1) ; if(class_exists($class)) { $action = new $class; $_instance[$name . $layer] = $action; return $action; - }elseif(class_exists($module . '\\' . $layer . '\\Empty' . $layer)){ - $class = $module . '\\' . $layer . '\\Empty' . $layer; + }elseif(class_exists($module . '\\' . $layer . '\\Empty')){ + $class = $module . '\\' . $layer . '\\Empty'; return new $class; }else{ return false;