【发布时间】:2019-10-08 14:57:43
【问题描述】:
我在 Laravel 中使用路由器,我的路由文件是这样的
Route::get('/{product_slug}', 'HomeController@subpage');
Route::get('/login', 'AuthController@login');
Route::get('/signup', 'AuthController@signup');
Route::get('/products', 'HomeController@products');
Route::get('/product/{product_id}', 'HomeController@product_detail');
如果 /{product_slug} 在数组 ('product_a', 'product_b') 中,则使用 HomeController@subpage,但如果不使用以下路线。
例如,
如果用户输入www.sample.co/product_a,它将使用HomeController@subpage
但如果用户输入www.sample.co/signup,它将使用AuthController@signup
如何设置路线。
谢谢。
【问题讨论】:
标签: php laravel laravel-5 routes