From a35bbd3675815fd99401644f8e668c66610e14ab Mon Sep 17 00:00:00 2001 From: huangdijia Date: Thu, 7 Jan 2016 10:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E8=B7=AF=E7=94=B1=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BF=AB=E6=8D=B7=E4=BC=A0=E5=8F=82=20=E7=94=A8?= =?UTF-8?q?=E6=B3=95=EF=BC=9A'=E5=AD=90=E5=9F=9F=E5=90=8D'=3D>'=E6=A8=A1?= =?UTF-8?q?=E5=9D=97[/=E6=8E=A7=E5=88=B6=E5=99=A8/=E6=93=8D=E4=BD=9C]=3Fva?= =?UTF-8?q?r1=3Da&var2=3Db&var3=3D*'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 7da831de..4eedb2ad 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -216,6 +216,7 @@ class Route // 子域名部署规则 // '子域名'=>'模块[/控制器/操作]' // '子域名'=>['模块[/控制器/操作]','var1=a&var2=b&var3=*']; + // '子域名'=>'模块[/控制器/操作]?var1=a&var2=b&var3=*'; if ($rule instanceof \Closure) { // 执行闭包 $reflect = new \ReflectionFunction($rule); @@ -226,18 +227,25 @@ class Route $result = $rule[0]; if (isset($rule[1])) { // 传入参数 - parse_str($rule[1], $parms); + parse_str($rule[1], $params); if (isset($panDomain)) { - $pos = array_search('*', $parms); + $pos = array_search('*', $params); if (false !== $pos) { // 泛域名作为参数 - $parms[$pos] = $panDomain; + $params[$pos] = $panDomain; } } - $_GET = array_merge($_GET, $parms); + $_GET = array_merge($_GET, $params); } } else { - $result = $rule; + if (strpos($rule, '?')) { + $result = strstr($rule, '?', true); + $query = strstr($rule, '?'); + parse_str(substr($query, 1), $params); + $_GET = array_merge($_GET, $params); + }else{ + $result = $rule; + } } if (0 === strpos($result, '\\')) { // 绑定到命名空间 例如 \app\index\behavior