Laravel - 使用 DB facade 实现CURD
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Student;
class studentController extends Controller
{
public function index()
{
#新增
// DB::insert('insert into student(name,age) values(?,?)',['劫',15]);
#修改
// DB::update('update student set age=? where id=?',[66,'3']);
#删除
DB::delete('delete from student where id=?',[2]);
#查询
$students = DB::select('select * from student');
}
}