## 路由新特性
5.1提供了更加對象化的路由定義,路由的參數在新版本中支持方法調用,例如:
~~~
Route::get('hello/:name','index/hello')
->ext('html')
->after(function(){
echo 'after';
});
~~~
等效于
~~~
Route::get('hello/:name','index/hello',[
'ext' => 'html',
'after' => function(){
echo 'after';
}
]);
~~~
路由分組定義同樣支持
~~~
Route::group('blog',function(){
Route::get(':id','blog/read');
})->ext('html');
~~~
路由參數增加`cross_domain`或者使用`crossDomain`方法,表示該路由規則(或者路由分組)跨域名有效。
`domain`方法支持同時對多個域名設置相同的路由規則
~~~
Route::domain(['blog','admin'],function(){
Route::rule('hello/:name','index/hello');
});
~~~