批量插入数据insert into select示例
//增加 $addSql =" insert into hxqc_auth_group_limits(group_id,company_id)"; foreach ($add_data as $val) { $addSql .=" select '$k','$val' union all"; } if(strrpos($addSql, 'union all', -1)===strlen($addSql)-9){ $addSql = rtrim($addSql,'union all'); $insertAffect = M()->execute($addSql); if($insertAffect === false) { $this->rollback(); return 1; } }