调用未定义的方法Illuminate \ Routing \ Route :: get() [英] Call to undefined method Illuminate\Routing\Route::get()
本文介绍了调用未定义的方法Illuminate \ Routing \ Route :: get()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚安装了Laravel 5.1,访问了我的应用程序的主页,但出现以下错误:
I have just installed Laravel 5.1, visited the home page of my app and i get the following error:
哇,看起来好像出了点问题.
Whoops, looks like something went wrong.
1/1
routes.php第16行中的FatalErrorException
FatalErrorException in routes.php line 16:
调用未定义的方法Illuminate \ Routing \ Route :: get()
Call to undefined method Illuminate\Routing\Route::get()
在routes.php第16行中
in routes.php line 16
这是我的route.php文件:
This is my routes.php file:
<?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
.
You actually don't have to import any class as Laravel registers a global alias Route
.
如果要导入正确的类,则为:
If you want to import the right class, that would be:
use Illuminate\Support\Facades\Route;
这篇关于调用未定义的方法Illuminate \ Routing \ Route :: get()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文