从特定的时间戳数据库中获取数据laravel-api

时间:2020-07-01 13:19:17

标签: mysql laravel api routes

我尝试将数据从特定的时间戳获取到数据库DT中。 我尝试这个但没有用 代码:

Route::get('/l', function(){
    $day = date('Y-m-d H:i:s', strtotime($_GET['day']));
    $users = DB::select('select * from DT where (`timestamp` = "'.$day.'")' );

    return $users;
})->middleware('auth:api');

在邮递员中,我置入参数:day 2020-07-01

有帮助吗?

1 个答案:

答案 0 :(得分:0)

解决了!

Route::get('/l', function(){
   
    $day = date('Y-m-d ', strtotime($_GET['day']));
    $users = DB::select('select * from DT where (`timestamp` like "'.$day.'%")' );
   
})->middleware('auth:api');