网站首页 laravel框架
跟我一起学Laravel--Route
发布时间:2016-08-21 03:02查看次数:3274
子域名绑定
Route::group(array('domain' => '{account}.myapp.com'), function()
{
Route::get('user/{id}', function($account, $id)
{
//
});
});
路由过滤器--路由执行前过滤
Route::group(array('before' => 'auth'), function()
{
Route::get('/', function()
{
// Has Auth Filter
});
Route::get('user/profile', function()
{
// Has Auth Filter
});
});
路由参数全局限制
Route::pattern('id', '[0-9]+');
路由分组正则表达过滤
Route::get('user/{id}/{name}', function($id, $name)
{
//
})
->where(array('id' => '[0-9]+', 'name' => '[a-z]+'))
关键字词:跟我一起学Laravel--Route