Laravel中RouteCollection.php第161行中的NotFoundHttpException [英] NotFoundHttpException in RouteCollection.php line 161 in laravel

查看:512
本文介绍了Laravel中RouteCollection.php第161行中的NotFoundHttpException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在routes.php中添加了以下路线:

I added the following routes in routes.php:

Route::get('/', function () {
    return 'Hello World';
});

Route::get('user/{id}', function ($id) {
    return 'User '.$id;
});

Route::post('foo/bar', function () {
    return 'Hello World';
});

Route::put('foo/bar', function () {
 //
});

Route::delete('foo/bar', function () {
   //
});

浏览到/laravel/user/5/

抱歉,找不到您要查找的页面.

RouteCollection.php行161:1中的NotFoundHttpException) RouteCollection.php第161.2行)位于 Router.php第533行的RouteCollection-match(object(Request)) Router.php第512行中的Router-findRoute(object(Request)).

NotFoundHttpException in RouteCollection.php line 161:1) in RouteCollection.php line 161.2) at RouteCollection-match(object(Request)) in Router.php line 533 at Router-findRoute(object(Request)) in Router.php line 512.

以及其他一些错误.

我的路由配置有什么问题吗?

Is anything wrong in my route configuration?

推荐答案

此问题是因为通过命令促销安装laravel时,我按照文档建议运行了"composer create-project laravel/laravel –-prefer-dist".

This problem is because when installed laravel through command promot i ran "composer create-project laravel/laravel –-prefer-dist" as the document suggest.

所以实际上正确的命令是"composer create-project laravel/laravel yourProjectName"

so actually correct command is "composer create-project laravel/laravel yourProjectName"

这篇关于Laravel中RouteCollection.php第161行中的NotFoundHttpException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆