1、$goods_model->load(Yii::$app->request->post());
2、$goods_model->attributes = $_POST['Goods'];
备注:只有经过数据验证后才能给模型赋值 model中增加
public function rules() { return [ [['goods_name','goods_price','goods_big_img','goods_introduce'], 'required'], ]; }
1、$goods_model->load(Yii::$app->request->post());
2、$goods_model->attributes = $_POST['Goods'];
备注:只有经过数据验证后才能给模型赋值 model中增加
public function rules() { return [ [['goods_name','goods_price','goods_big_img','goods_introduce'], 'required'], ]; }
转载于:https://my.oschina.net/colin86/blog/521430