Laravel 5:处理动态和静态路由
Laravel 5: Handling Dynamic and Static routes
在 Laravel5 中有没有一种方法可以定义处理动态路由而不与当前静态路由冲突的路由?类似以下内容:
// Dynamic routes
Route::get('{permalink}', function($permalink) {
//look for matching username on the table (bind perhaps?)
});
// Static routes
Route::get('home', 'HomeController@index');
Route::get('products', 'ProductController@index');
伙计们,有什么想法吗?谢谢
静态和动态路由不应相互冲突。只需要将静态路由放在高于动态路由的位置即可。
在 Laravel5 中有没有一种方法可以定义处理动态路由而不与当前静态路由冲突的路由?类似以下内容:
// Dynamic routes
Route::get('{permalink}', function($permalink) {
//look for matching username on the table (bind perhaps?)
});
// Static routes
Route::get('home', 'HomeController@index');
Route::get('products', 'ProductController@index');
伙计们,有什么想法吗?谢谢
静态和动态路由不应相互冲突。只需要将静态路由放在高于动态路由的位置即可。