问题:
'resultset_type'=>'array'
使用模型查询,想得到数组结构
使用方式:
$data = $this->alias('a')->join('category c','a.cat_id =c.id')->select()->toArray();
解决:
在database.php中设置返回的数据类型
1、全局改为 'resultset_type'=>'collection'
2、局部 在模型中加入
protected $resultSetType='collection';