改进Response类 支持扩展不同的输出类型 改进Model类 不同的模型采用不同的查询对象实例 修正Request类一处错误 助手函数view改进 直接返回Response类对象实例

This commit is contained in:
thinkphp
2016-05-16 14:18:47 +08:00
parent 891c1f99f2
commit 199825ec32
15 changed files with 420 additions and 212 deletions

View File

@@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\response;
use think\Response;
class Json extends Response
{
// 输出参数
protected $options = [
'json_encode_param' => JSON_UNESCAPED_UNICODE,
];
/**
* 处理数据
* @access protected
* @param mixed $data 要处理的数据
* @return mixed
*/
protected function output($data)
{
// 返回JSON数据格式到客户端 包含状态信息
$data = json_encode($data, $this->options['json_encode_param']);
return $data;
}
}