【发布时间】:2017-05-29 12:03:56
【问题描述】:
我是Laravel 的新手。
routes/api.php 这个函数我已经写好了
Route::group(['namespace' => "Catalogue"],function(){
Route::resource('product','Product');
});
我已经创建了一个资源控制器:
app/Controllers/Catalogue/Product.php
这是我的索引方法:
public function index()
{
$pdo = DB::select('select count(*) from offers');
return $pdo;
}
我正在尝试从 url 获取 index 方法的结果:
http://localhost:8000/api/Catalogue/product
但是,这会导致 404 not found。
注意:这部分url没有问题http://localhost:8000/api
【问题讨论】:
-
Route groups allow you to share route attributes, such as middleware or namespaces, across a large number of routes without needing to define those attributes on each individual route.--product是中间件还是命名空间?