我有一些 Laravel 的路线问题。我想是因为我没有采取好的方法,但是...
这是我的代码:
Route::group(array('prefix' => 'products'), function()
{
Route::get('', array('uses'=>'products@index'));
//show all the products
Route::get('{Categorie}',array('uses'=>'products@categorie'))->where('Categorie','^[A-Z][a-z0-9_-]{3,19}$');
//show the products of this categorie
Route::get('{shopname}',array('uses'=>'products@shopname'))->where('shopname','^[a- z][a-z0-9_-]{3,19}$');
//show the product of this shopname
});
Route::group(array('prefix' => '/products/{:any}'), function()
{
//no index because productName is not optionnal
Route::get('{productName}', array('uses'=>'product@getProduct'));
//the Product controller is now SINGULAR
//show this product in particular
});
所以它适用于第一组... mysite.fr/products => ok mysite.fr/MyCategorie => ok mysite.fr/mashopname => ok
但是当我添加第二个参数时:
mysite.fr/products/myshopname/myfirstproduct
我收到了一个带有特定消息的错误...
非常感谢你的帮助 !