将第二个参数添加到laravel 5中的控制器中的操作不起作用

时间:2015-04-27 19:00:39

标签: laravel laravel-4 laravel-5

我有这条路线:

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)

1 个答案:

答案 0 :(得分:1)

您忘记了逗号,

$items_arr = explode(",", $items);
//                      ^