我的Laravel版本是5.5
在api.php里面定义路由如下
<?php
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
$api->group(['namespace' => 'App\Api\Controllers'] ,function ($api){
$api->get('lessons' , 'LessonsController@index');
});
});
Terminal 里执行
[root@iZuf632lmt0g68o3jraamiZ ShareLoverServer]# php artisan api:routes
Your application doesn't have any routes.
但是浏览器访问URL没问题
http://mysite/api/lessons
jie jue le ma?
No
升级一下dingo的版本
Most helpful comment
https://github.com/qq15725/api/commit/36ab388db57e3e7a51c604865c952b54458e0645