laravel中的CRUD操作中,通过对代表数据表中row的model对象操作,来更新数据库表。
对于创建新的row的操作,有两种功能上相同的方法:
1.create;
$user = User::create(array(‘email => ‘[email protected]‘,‘password‘=>‘mypassword‘));
2.new and save
$user = new User; $user->email = ‘[email protected]‘; $user->password = ‘mypassword‘; $user->save();
时间: 2024-10-13 00:08:30