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

前端 未结 9 2563
佛祖请我去吃肉
佛祖请我去吃肉 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:35

    ActiveRecord class has an attribute called attributes. You can find its description here: http://www.yiiframework.com/doc/api/1.1/CActiveRecord#attributes-detail.

    In order to get all attributes in an array, use this: $var = $model->attributes;

提交回复
热议问题