【发布时间】:2018-02-17 19:58:06
【问题描述】:
我是 Lumen 的新手,刚刚尝试创建一个应用程序。我在 Application->Laravel\Lumen\Concerns{closure}(8, 'Undefined variable: app', '/Users/test/Sites/books/routes/web.php', 14, array( 'router' => object(Router))) 当我尝试使用这段代码时:
$app->group(['prefix' => 'book/'], function() use ($app) {
$app->get('/','BooksController@index'); //get all the routes
$app->post('/','BooksController@store'); //store single route
$app->get('/{id}/', 'BooksController@show'); //get single route
$app->put('/{id}/','BooksController@update'); //update single route
$app->delete('/{id}/','BooksController@destroy'); //delete single route
});
根据文件https://lumen.laravel.com/docs/5.5/routing,这应该可以工作。我正在关注https://paulund.co.uk/creating-a-rest-api-with-lumen 上的教程,我知道 5.5 几天前刚刚发布,所以可能还没有人知道答案,但我们将不胜感激。
【问题讨论】: