一、在Config文件里的dataBase.php字段 resultset_type 设置为 'collection'php
二、使用model查询数据时,数组
a、以find结尾的查询,返回的是数组,须要使用Collection类将数组转为数据集,如:spa
// 经过数据集隐藏接口不须要的字段参数,而不影响其余接口
$collection = Collection::make($result); $result = $collection->hidden(['summary']);
b、以select结尾的查询,返回的Collection集,则直接使用,如:code
$result = $result->hidden(['summary']);