From 93cd95640ba4433017e66af1f695f4c12e906468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BA=A6=E5=BD=93=E8=8B=97=E5=84=BF?= Date: Fri, 19 Apr 2013 16:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E5=A4=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Think/Transform.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Think/Transform.php b/Library/Think/Transform.php index 9d107e44..a0ed9caf 100644 --- a/Library/Think/Transform.php +++ b/Library/Think/Transform.php @@ -40,8 +40,11 @@ class Transform { // Transform::jsonDecode('abc', true); static public function __callStatic($method, $params){ $type = substr($method, 0, strlen($method) - 6); - $method = substr($method, -6); + $method = strtolower(substr($method, -6)); $assoc = empty($params[2]) ? true : false; + if(!in_array($method, ['encode', 'decode'])){ + throw new Think\Exception("call to undefined method {$method}"); + } return self::$method($params[0], $type, $assoc); } }