2013-01-07 30 views
1

我有一點麻煩讓Laravel 4路線工作 - 只是無法讓我的頭在它周圍,我做錯了什麼。不能通過uri段

我的作曲家包是最新的,我使用最新版本的illuminate/app。

這裏的工作正常路線:

GET /hello 

Route::get('hello', function() 
{ 
    return 'yey'; 
}); 

但我就是不能得到第二URI段傳遞的PARAM。

這不起作用:

GET /hello/1 

Route::get('hello/(:num)', function($id) 
{ 
    return 'yey ' . $id; 
}); 

或者:

GET /hello/1 

Route::get('hello/(:any)', function($id) 
{ 
    return 'yey ' . $id; 
}); 

最後,我希望有一個控制器來處理我的東西 - 但我不知道我在做什麼錯此時此刻。

回答

3

差不多。真的你想這樣做:

Route::get('hello/{num}', function($id) 
{ 
    return 'yey ' . $id; 
}); 
+0

謝謝菲爾 - 這是修復! – acairns