📅  最后修改于: 2022-03-11 14:54:33.303000             🧑  作者: Mango
// query builder
$query = DB::table('table_name')->where('id', 1);
// binding replaced
$rawQuery = str_replace_array('?', $query->getBindings(), $query->toSql());
// for laravel 5.8^
$rawQuery = Str::replaceArray('?', $query->getBindings(), $query->toSql());
dd($rawSql); // "select * from `table_name` where `id` = 1";