From a807dbce81ab23e1911f16a77aca3062ea71b29b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 31 Dec 2015 20:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Btemplate=E7=B1=BBparseTemplat?= =?UTF-8?q?eFile=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E8=B7=A8=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=B0=83=E7=94=A8=E6=A8=A1=E6=9D=BF=20route=E7=B1=BBm?= =?UTF-8?q?ethod=E8=B7=AF=E7=94=B1=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20GET|POST=20=E9=80=89=E6=8B=A9=E5=A4=9A?= =?UTF-8?q?=E7=A7=8D=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/route.php | 4 ++-- library/think/template.php | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/library/think/route.php b/library/think/route.php index cc7de467..5fd66a8c 100644 --- a/library/think/route.php +++ b/library/think/route.php @@ -249,7 +249,7 @@ class Route $option = $val['option']; $pattern = $val['pattern']; // 请求类型检测 - if (isset($option['method']) && REQUEST_METHOD != strtoupper($option['method'])) { + if (isset($option['method']) && false === stripos($option['method'], REQUEST_METHOD)) { continue; } // 伪静态后缀检测 @@ -289,7 +289,7 @@ class Route if (is_array($route)) { $option1 = $route[1]; // 请求类型检测 - if (isset($option1['method']) && REQUEST_METHOD != strtoupper($option1['method'])) { + if (isset($option1['method']) && false === stripos($option1['method'], REQUEST_METHOD)) { continue; } // 伪静态后缀检测 diff --git a/library/think/template.php b/library/think/template.php index 55e8ea59..12836d02 100644 --- a/library/think/template.php +++ b/library/think/template.php @@ -727,10 +727,10 @@ class Template case 'array': // 识别为数组 $parseStr = $first . '[\'' . implode('\'][\'', $vars) . '\']'; break; - case 'obj': // 识别为对象 + case 'obj': // 识别为对象 $parseStr = $first . '->' . implode('->', $vars); break; - default: // 自动判断数组或对象 只支持二维 + default: // 自动判断数组或对象 只支持二维 $parseStr = 'is_array(' . $first . ')?' . $first . '[\'' . implode('\'][\'', $vars) . '\']:' . $first . '->' . implode('->', $vars); } } @@ -917,10 +917,12 @@ class Template private function parseTemplateFile($template) { if (false === strpos($template, '.')) { - return (defined('THEME_PATH') && substr_count($template, '/') < 2 ? THEME_PATH : $this->config['tpl_path']) . $template . $this->config['tpl_suffix']; - } else { - return $template; + // 跨模块支持 + $template = strpos($template, '@') ? + APP_PATH . str_replace('@', '/' . basename($this->config['tpl_path']) . '/', $template) . $this->config['tpl_suffix'] : + (defined('THEME_PATH') && substr_count($template, '/') < 2 ? THEME_PATH : $this->config['tpl_path']) . $template . $this->config['tpl_suffix']; } + return $template; } /**