2014-10-10 44 views
1

我是Laravel的新手。正如我在標題中提到的那樣,Laravel中是否有像AngularJS(否則)那樣的路由聲明?例如,我將定義一些路由,並將所有其他URI請求重定向到某個頁面/索引頁面/錯誤頁面?是否有Laravel路線鏈接Angularjs /否?

回答

0

你顯然沒有嘗試Google:laravel routes

http://laravel.com/docs/4.2/routing

+0

對不起,仍然找不到那樣的人。你能提一下嗎? – 2014-10-10 14:32:31

+0

我真的不明白......你在尋找一個全面的? – 2014-10-10 14:42:30

2

你的問題有點不清楚,但它聽起來像你正在尋找一個包羅萬象的路線。

根據Laravel Snippets sites,如果將以下內容添加到app/routes.php的末尾,這應該會給你想要的。

Route::get('{slug?}', function(){ 
    return 'Catch All'; 
})->where('slug', '.+'); 
0

在你Laravel應用,定位於APP/routes.php文件

這就是你的路由都將保留。你可以像這樣定義它們:

Route::get('/home', function() { 
    return View::make('pages.home'); 
}); 

,或呼叫控制器:

Route::get('/home', ['uses' => '[email protected]']); 

你可以叫HTTP動詞,以及像這樣:

Route::post('/some/form', ['uses' => '[email protected]']); 

請在這裏看到更多的info:http://laravel.com/docs/4.2/routing