Yii model to array?

前端 未结 14 1946
南笙
南笙 2020-12-08 19:32

How can I convert the result of Trips::model()->findAll() to an array?

14条回答
  •  感情败类
    2020-12-08 20:21

    Use simply:

    $trips = Trips::model()->findAll();
    
    $trips_array = CJSON::decode(CJSON::encode($trips));
    

    Note: This is not good way but returns array

提交回复
热议问题