如何使用PHP往数据库添加大量数据
<?php
namespace app\index\controller;
use think\Db;
class Index
{
public function index()
{
$begin = time();
for($i=1;$i<=10000;$i++){
$data['id'] = $i;
$data['openid'] = 'fsadfdsgadfsgdfg';
$data['nickname'] = '咔咔';
$data['company'] = '蚂蚁未来';
$data['mobile'] = '15289310354';
$addId = Db::table('wxb_move_user')->order('id desc')->insertGetId($data);
}
$end = time();
echo "用时 ".($end-$begin)." 秒 <hr/>";
}
}