Yii - How to get a values array from an Active Record

前端 未结 9 2559
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-15 13:12

Using Yii, how can I get an array from an Active Record.

Say something like this:

array(\'foo\', \'bar\', \'lala\')

From something like thi

9条回答
  •  渐次进展
    2021-02-15 13:30

    if you are using Yii1.1 and you need to get ALL data from AR as array you need to care about that it self. Yii1.1 AR doesn't have this feature out of the box

    In Yii2 AR has asArray() method, it's very helpful

    I hope my answer helps someone

提交回复
热议问题