From 336597859af9fb61a384badf5663ecc3d2c9b238 Mon Sep 17 00:00:00 2001 From: raorf Date: Fri, 26 Oct 2018 14:55:08 +0800 Subject: [PATCH] Update application/index/controller/Ajax.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正application/config.php中'app_trace'=>Env::get('app.trace', true)时,浏览器访问e用户中心”/index/user"F12调试显示错误:Uncaught SyntaxError: Unexpected token < --- application/index/controller/Ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/index/controller/Ajax.php b/application/index/controller/Ajax.php index c4e2e865..fda48511 100644 --- a/application/index/controller/Ajax.php +++ b/application/index/controller/Ajax.php @@ -26,7 +26,7 @@ class Ajax extends Frontend $controllername = input("controllername"); $this->loadlang($controllername); //强制输出JSON Object - $result = 'define(' . json_encode(Lang::get(), JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . ');'; + $result = jsonp(Lang::get(), 200, [], ['json_encode_param' => JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE]); return $result; }