From bfe8f2476339f622a86729dbef598e8cfb09258b Mon Sep 17 00:00:00 2001 From: oldrind <1401019000@qq.com> Date: Wed, 17 Feb 2016 18:50:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3include=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Template.php | 2 +- tests/thinkphp/library/think/include.html | 3 ++- tests/thinkphp/library/think/include2.html | 1 + tests/thinkphp/library/think/templateTest.php | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 tests/thinkphp/library/think/include2.html diff --git a/library/think/Template.php b/library/think/Template.php index 315a0e28..5a05c1cb 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -404,9 +404,9 @@ class Template } $parseStr = str_replace('[' . $k . ']', $v, $parseStr); } + $content = str_replace($match[0], $parseStr, $content); // 再次对包含文件进行模板分析 $funReplace($parseStr); - $content = str_replace($match[0], $parseStr, $content); } unset($matches); } diff --git a/tests/thinkphp/library/think/include.html b/tests/thinkphp/library/think/include.html index ac622e75..e01ae9ef 100644 --- a/tests/thinkphp/library/think/include.html +++ b/tests/thinkphp/library/think/include.html @@ -1 +1,2 @@ - \ No newline at end of file + +{include file="include2" /} \ No newline at end of file diff --git a/tests/thinkphp/library/think/include2.html b/tests/thinkphp/library/think/include2.html new file mode 100644 index 00000000..6d4dd4be --- /dev/null +++ b/tests/thinkphp/library/think/include2.html @@ -0,0 +1 @@ +include2 \ No newline at end of file diff --git a/tests/thinkphp/library/think/templateTest.php b/tests/thinkphp/library/think/templateTest.php index b1522197..e4ebd77d 100644 --- a/tests/thinkphp/library/think/templateTest.php +++ b/tests/thinkphp/library/think/templateTest.php @@ -266,9 +266,11 @@ EOF;