【发布时间】:2017-11-24 05:58:21
【问题描述】:
我在控制台中通过这个 cmd 启动了服务器,它工作正常
php -S localhost:8000 -t public
当我像这样在邮递员中为流明调用 API 时:
localhost:8000/GitHub/twinfield/public/index.php/user
API 可用于插入,但当我这样调用时:
localhost:8000/GitHub/twinfield/user
错误如下:
(1/1) RoutesRequests.php(第 226 行)中的 NotFoundHttpException RoutesRequests.php 中的 Application->handleDispatcherResponse(array(0)) (第 164 行)在 Application->Laravel\Lumen\Concerns{closure}() 中 RoutesRequests.php(第 413 行)位于 Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php(第 166 行)在 Application->dispatch(null) 中 RoutesRequests.php(第 107 行)位于 Application->run() in 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。
【问题讨论】:
标签: php laravel .htaccess postman lumen-5.4