后端开发|php教程
php,laravel,eloquent
后端开发-php教程
最近在使用Laravel。
asp网上购物平台系统源码,vscode怎么打开npm,ubuntu 编写uwp,怎么使用tomcat代理,爬虫宝宝,php json.php,东莞seo项目怎样优化,qq卡盟平台网站源码下载,党政新闻模板lzw
想批量插入近千条数据,知道直接写sql是可以批量插入的。
tms物流管理系统源码,ubuntu创建测试文件,卸载删除tomcat注册表,scrapy 爬虫网站,php八个魔术方法,企业seo推荐lzw
另外框架ORM Eloquent 提供了一个Create方法:
物流b2b源码,vscode减小一个缩进,ubuntu添加启动,tomcat最大内存池,python爬虫变现,会员管理系统 代码php,天津百度seo在线咨询lzw
/*** Save a new model and return the instance.** @param array $attributes* @return \Illuminate\Database\Eloquent\Model|static*/ public static function create(array $attributes) { $model = new static($attributes); $model->save(); return $model; }
此方法可以很方便的插入数据,但是不能批量插入。
基于性能考虑吗,也不想写SQL,请问Eloquent 有针对这种情况的方法么?
回复内容:
最近在使用Laravel。
想批量插入近千条数据,知道直接写sql是可以批量插入的。
另外框架ORM Eloquent 提供了一个Create方法:
/*** Save a new model and return the instance.** @param array $attributes* @return \Illuminate\Database\Eloquent\Model|static*/ public static function create(array $attributes) { $model = new static($attributes); $model->save(); return $model; }
此方法可以很方便的插入数据,但是不能批量插入。
基于性能考虑吗,也不想写SQL,请问Eloquent 有针对这种情况的方法么?
DB::table(users)->insert(array( array(email => aylor@, votes => 0), array(email => dayle@, votes => 0),));
详情