我当前的网站位于Codeigniter:http://www.tenders.af我想将其转换为 Laravel 4.1
我遇到了路由这个问题,我无法解决它,但任何帮助都将不胜感激。
我在codeigniter中的路线:
$route['afghanistan-tenders/(:any)'] = 'home/details/$1';
如何在Laravel 4或4.1中像上述路线一样写作
答案 0 :(得分:1)
Route::get('/afghanistan-tenders/{id}', ['uses' => 'HomeController@details']);
然后在你的HomeController中
public function details($id)
{
echo $id;
}
编辑:根据您的评论,您可以这样做吗?
Route::get('/afghanistan-tenders/{id}/school-development', ['uses' => 'HomeController@details']);
或
Route::get('/afghanistan-tenders/{id}/{name}', ['uses' => 'HomeController@details']);