我刚刚安装了Laravel 5.1,访问了我的应用程序的主页,但出现以下错误:
这是我的routes.php文件:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
return view('welcome');
});
最佳答案
此导入是错误的:
use Illuminate\Routing\Route;
当Laravel注册一个全局别名
Route
时,您实际上不必导入任何类。如果要导入正确的类,则为:
use Illuminate\Support\Facades\Route;
关于php - 调用未定义的方法Illuminate\Routing\Route::get(),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32285647/