YII ar 对象转变数组
/** * 数据库查询 * AR操作 */ public function actionCountry(){ $country_model = new Country(); //查询所有数据all() one 一条数据 $country_list = $country_model::find() -> orderBy('id desc') -> all(); # 转数组 foreach ($country_list as $model) { $result[] = $model->attributes; } echo '<pre/>'; print_r($result); exit; }
方便后期继续使用ar对象修改数据