Laravel:为什么函数参数变为空数组

时间:2018-02-01 13:20:34

标签: php laravel-5

我有一个函数接受一些用于过滤报告数据的可选参数。出于某种原因,当我添加第三个可选的User参数(隐式绑定)时,我的可选日期变为空数组。那是为什么?

//Example URLS
example.com/reports // Breaks because $start_time & $end_time are now arrays for some reason
example.com/reports/2018-02-01/2018-02-01 // Works Fine
example.com/reports/2018-02-01/2018-02-01/neve12ende12 // Works Fine

//Route File
Route::get('reports/{start}/{end}/{user?}', 'ReportsController@index');
Route::get('reports','ReportsController@index');

//ReportController
public function index($start_time = null, $end_time = null) {
    // $start_time = null;
}

public function index($start_time = null, $end_time = null, User $user = null) {
    // $start_time = [];
}

0 个答案:

没有答案