更新时间:2023-02-17 09:33:15
您通过以下方式调用它
http://localhost:8080/api/test
^^^
如果您查看 app/Providers/RouteServiceProvider.php
,您会看到默认情况下,它会为API路由设置api
前缀,您当然可以根据需要更改.
If you look in app/Providers/RouteServiceProvider.php
you'd see that by default it sets the api
prefix for API routes, which you can change of course if you want to.
protected function mapApiRoutes()
{
Route::group([
'middleware' => 'api',
'namespace' => $this->namespace,
'prefix' => 'api',
], function ($router) {
require base_path('routes/api.php');
});
}