第一种:
$model = new User(); foreach($data as $attributes) { $_model = clone $model; $_model->setAttributes($attributes); $_model->save(); }
第二种:
$model = new User(); foreach($data as $attributes) { $model->isNewRecord = true; $model->setAttributes($attributes); $model->save() && $model->id=0; }

相关文章:

  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-02-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案