计算机网络/计算机科学与应用/系统/运维/开发

tp5.0报错 Call to a member function toArray() on array

问题:

'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';


人各有命,但命运也从来不是随机发牌,而是每个人主动选择的结果。

评论

^