From 31ec4d9fa9ca542be2107d0337e334345228fdbb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 23 Nov 2015 21:44:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=B7=AF=E7=94=B1=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=B8=89=E7=A7=8D=E6=A8=A1=E5=BC=8F=EF=BC=9A=E6=B7=B7?= =?UTF-8?q?=E5=90=88=E6=A8=A1=E5=BC=8F=20=E5=88=87=E6=8D=A2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20=E5=8F=8A=20=E5=BC=BA=E5=88=B6=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/app.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/think/app.php b/library/think/app.php index d1cc0035..cce4c3fe 100644 --- a/library/think/app.php +++ b/library/think/app.php @@ -15,7 +15,6 @@ namespace think; * App 应用管理 * @author liu21st */ - class App { @@ -260,13 +259,18 @@ class App // 开启路由 则检测路由配置 并默认读取 url_route_rules 参数 Route::register($config['url_route_rules']); $result = Route::check(__INFO__, $config['pathinfo_depr']); + if (false === $result) { - throw new Exception('route not define '); + // 路由无效 + if ($config['url_route_must']) { + throw new Exception('route not define '); + } else { + $result = Route::parseUrl(__INFO__); + } } } else { $result = Route::parseUrl(__INFO__); } - } // 去除URL后缀 $_SERVER['PATH_INFO'] = preg_replace($config['url_html_suffix'] ? '/\.(' . trim($config['url_html_suffix'], '.') . ')$/i' : '/\.' . __EXT__ . '$/i', '', $_SERVER['PATH_INFO']);