我在控制台中通过这个 cmd 启动服务器,它工作正常
php -S localhost:8000 -t public
当我像这样在邮递员中为流明调用 API 时:
localhost:8000/GitHub/twinfield/public/index.php/user
API适用于插入,但是当我这样调用时:
localhost:8000/GitHub/twinfield/user
错误如下:
(1/1) NotFoundHttpException in RoutesRequests.php (line 226) at Application->handleDispatcherResponse(array(0)) in RoutesRequests.php (line 164) at Application->Laravel\Lumen\Concerns{closure}() 在 RoutesRequests。在 Application->sendThroughPipeline(array(), object(Closure)) 中的 RoutesRequests.php (第 166 行) 在 Application->dispatch(null) 在 RoutesRequests.php (第 107 行) 在 Application->run( ) 在 index.php 中(第 28 行)
我在 routes/web.php 中的路由文件:
$router->get('/', function () use ($router) {
//print_r('1234');die;
return $router->app->version();
});
$router->get('user','userController@index');
$router->get('user/{id}','userController@getuser');
$router->post('user','userController@createuser');
$router->post('user/{id}','userController@updateuser');
$router->delete('user/{id}','userController@deleteuser');
我已经尝试在 public/index.php 中解决这样的问题,但没有成功。
$request = Illuminate\Http\Request::capture();
$app->run($request);
我正在使用 Xampp 在 localhost 中工作。数据库是 MySQL,PHP 版本是 7.1。