
<?phpnamespace appindexcontroller;use thinkController;
use thinkDb;class Index extends Controller
{public function index(){$db = Db::name('user');# insert 返回值是影响记录的行数 插入数// $res = $db->insert([// 'email' => 'imooc_1@qq',// 'password' => md5('imooc_1'),// 'username' => 'imooc_1'// ]);#insertGetId 返回值插入数据的自增id// $res = $db->insertGetId([// 'email' => 'imooc_1@qq',// 'password' => md5('imooc_1'),// 'username' => 'imooc_1'// ]);#insertAll 返回插入数据成功的行数$data = [];for($i=10; $i<20; $i++){$data[] = ['email' => "imooc_{$i}@qq",'password' => md5("imooc_{$i}"),'username' => "imooc_{$i}"];}$res = $db->insertAll($data);dump($res);}
}?>
本文发布于:2024-03-12 14:28:00,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/1710648144144674.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
| 留言与评论(共有 0 条评论) |