Laravel RouteCollection.php 第 161 行中的 NotFoundHttpException

Laravel NotFoundHttpException in RouteCollection.php line 161

开始研究Laravel,遇到这个问题

文件:project/app/Http/routes.php

<?php

Route::get('about', 'PagesController@about');

我终端做的目录工程里

php artisan make:controller PagesController

文件:project/app/Http/Controllers/PagesController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;

class PagesController extends Controller
{
    public function about() 
    {
        return("About");
    }
}

您正在访问您提供的图像中的 / 路线。您的 routes.php 文件中未定义这就是您收到此错误的原因。

添加

Route::get('/', function() {
    return "hello world";
});

然后尝试这条路线:192.168.1.101/laravel-p/public/

注意 你已经在上面的代码中解释了 about 路由。所以走这条路线

`192.168.1.101/laravel-p/public/about`

You are accessing your / route in your provided image. Which is not defined in your routes.php file that's why you are getting this error.

Add

Route::get('/', function() { return "hello world"; });

and then try this route: 192.168.1.101/laravel-p/public/

Note you've explained the about route in your above code. So hit this route

192.168.1.101/laravel-p/public/about

没有..

enter image description here

<?php

Route::get('/', function() {
    return "hello world";
});

Route::get('about', 'PagesController@about');

您需要进入apache配置文件,并在laravel仍在工作的目录上指定AllowOverride Yes