【发布时间】:2018-04-19 08:39:27
【问题描述】:
大家好,我有代码:
{{ route('data', ['min' => 12, 'max' => 123, 'week' => 1, 'month' => 123]) }}
在路线中:
Route::get('/data/{array?}', 'ExtController@get')->name('data');
在 ExtController 中:
class GanttController extends Controller
{
public function get($array = [],
Request $request){
$min = $array['min'];
$max= $array['max'];
$week = $array['week'];
$month = $array['month'];
}
但这不起作用,我没有得到数组中的参数。如何在控制器中获取参数?
我尝试使用函数:serialize,但我得到错误:missing required params of the route. 因为我在路由中有?。
【问题讨论】:
-
我尝试做序列化,我得到错误:
missing required params.. -
@Jadasdas 你在哪里得到这个错误?