时间:2021-07-01 10:21:17 帮助过:3人阅读
controllers:
批量添加的数据$res数组是:
//拼接sql
$sql = ‘‘; foreach ($res as $key => $val) { $sql .= ‘(‘ . $val[‘article_id‘] . ‘,‘ . $val[‘user_id‘] . ‘,‘ ."‘". $val[‘share_link‘] ."‘".‘,‘ ."‘". $val[‘short_link‘] ."‘". ‘,‘ . $val[‘read_price‘] . ‘,‘."‘" . $val[‘created_at‘] ."‘". ‘,‘."‘" . $val[‘updated_at‘] ."‘" . ‘)‘.(($key)+1==count($res)?‘‘:‘,‘); } $arr = $this->share_record_model->insert_select($sql);
CI 框架批量添加数据(如果数据库有就更新数据)
标签:col turn image 数据 ice ret fun span count