2
在我的Laravel項目,我有以下文件夾結構Laravel嵌套控制器與寧靜
application/controllers/products.php
application/controllers/products/categories.php
在我products.php
class Products_Controller extends Base_Controller {
public $restful = true;
public function get_index()
{
$data['title'] = 'Products List';
return View::make('product.index',$data);
}
}
在我categories.php
class Products_Categories_Controller extends Base_Controller{
public $restful = true;
public function get_index(){
$data['title'] = "All Categtories";
return View::make('category.index', $data);
}
}
這是我routes.php
Route::get('products', array('as' => 'products', 'uses' => '[email protected]'));
Route::get('products/categories', array('as' => 'categories', 'uses' => '[email protected]'));
當我瀏覽example.com/products/categories
,我有404錯誤消息。請告訴我錯了我routes.php
你有你的服務器設置適當的重寫規則? –
是的..網站工作完美..但我不能去類別頁 – Mifas