From 2ba7455047ddfc20cd2b7cb691b7b774ee343c11 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Apr 2016 20:24:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3response=E7=B1=BB=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=92=8C=E6=96=B9=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Response.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/think/Response.php b/library/think/Response.php index 536be418..127b415d 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -14,7 +14,7 @@ namespace think; class Response { // 输出数据的转换方法 - protected static $tramsform = null; + protected static $transform = null; // 输出数据的类型 protected static $type = ''; // 输出数据 @@ -48,8 +48,8 @@ class Response } $data = $data ?: self::$data; - if (is_callable(self::$tramsform)) { - $data = call_user_func_array(self::$tramsform, [$data]); + if (is_callable(self::$transform)) { + $data = call_user_func_array(self::$transform, [$data]); } else { switch ($type) { case 'json': @@ -65,7 +65,7 @@ class Response } APP_HOOK && Hook::listen('return_data', $data); - + if ($return) { return $data; } @@ -80,9 +80,9 @@ class Response * @param mixed $callback 调用的转换方法 * @return void */ - public static function tramsform($callback) + public static function transform($callback) { - self::$tramsform = $callback; + self::$transform = $callback; } /**