From 2cef96147b4dc0fcd1cac1262189620b3de097d9 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 14 Dec 2015 09:15:04 +0800 Subject: [PATCH] =?UTF-8?q?View=E7=B1=BB=E5=A2=9E=E5=8A=A0parse=5Fvar?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0=20=E5=9C=A8=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E8=B0=83=E8=AF=95=E6=A8=A1=E5=BC=8F=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=20=E5=89=8D=E7=AB=AF=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/view.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/think/view.php b/library/think/view.php index 6a9c9876..d114be67 100644 --- a/library/think/view.php +++ b/library/think/view.php @@ -32,6 +32,7 @@ class View 'view_layer' => VIEW_LAYER, 'parse_str' => [], 'engine_type' => 'think', + 'parse_var' => false, ]; public function __construct(array $config = []) @@ -155,7 +156,11 @@ class View $replace = $this->config['parse_str']; $content = str_replace(array_keys($replace), array_values($replace), $content); } - + if (APP_DEBUG && $this->config['parse_var']) { + // debug模式时,将后台分配变量输出到浏览器控制台 + $parseVar = empty($vars) ? json_encode([]) : json_encode($vars); + $content .= ''; + } return $content; }