laravel基本数据库操作
版本:5.5 use Illuminate\Support\Facades\DB; //新增数据 返回一个布尔值 /** / $bool = DB::insert('insert into wt_001(username, old, note) values(?,?,?)',['李克勤','18','软件工程师']); dd($bool); /**/ //修改数据 返回修改到记录数 /** / $num = DB::update('update wt_001 set username = ? ,old = ? where id = ?',['李嘉诚',20,1]); /**/ //查询数据 /**/ $rs = DB::select('select * from wt_001'); //$rs = DB::select('select * from wt_001 where id =?',[2]);//条件查询 dd($rs); //var_dump($rs); /**/ //删除数据 /** / $num = DB::delete('delete from wt_001 where id = ?',[1]); dd($num); /**/