简化JSON格式返回调用

This commit is contained in:
thinkphp
2015-09-27 09:02:35 +08:00
parent 9dcfeefb1f
commit 7c2bcbcff2

View File

@@ -10,7 +10,6 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace think; namespace think;
use org\Transform;
class Response { class Response {
@@ -38,11 +37,11 @@ class Response {
switch ($type){ switch ($type){
case 'json': case 'json':
// 返回JSON数据格式到客户端 包含状态信息 // 返回JSON数据格式到客户端 包含状态信息
$data = Transform::jsonEncode($data); $data = json_encode($data, JSON_UNESCAPED_UNICODE);
break; break;
case 'xml': case 'xml':
// 返回xml格式数据 // 返回xml格式数据
$data = Transform::xmlEncode($data); $data = \org\Transform::xmlEncode($data);
break; break;
case 'jsonp': case 'jsonp':
// 返回JSON数据格式到客户端 包含状态信息 // 返回JSON数据格式到客户端 包含状态信息