From 420fdd9eafb0e30f005bf3f185d573a2ee4a8e38 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 12 Jun 2016 18:22:48 +0800 Subject: [PATCH] =?UTF-8?q?Model=E7=B1=BB=E7=9A=84json=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 0996872f..1b7b251f 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -325,7 +325,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess case 'array': $value = (array) $value; case 'json': - $value = json_encode($value, JSON_UNESCAPED_UNICODE); + $option = !empty($param) ? (intval)$param : JSON_UNESCAPED_UNICODE; + $value = json_encode($value, $option); break; case 'serialize': $value = serialize($value);