我有这条路线:
Route::get('customer/{id}/invoice/{items}', 'CustomersController@invoice');
并在控制器中执行此操作:
public function invoice($id, $items){
$items_arr = explode("," $items);
}
运行页面时:http://localhost:8080/pal/public/customer/1/invoice/1,2
我收到了这个错误:
syntax error, unexpected '$items' (T_VARIABLE)
答案 0 :(得分:1)
您忘记了逗号,
$items_arr = explode(",", $items);
// ^
)