调用未定义的方法 Illuminate\Routing\Route::get()
Call to undefined method Illuminate\Routing\Route::get()
我刚刚安装了 Laravel 5.1,访问了我的应用程序的主页,但出现以下错误:
Whoops, looks like something went wrong.
1/1
FatalErrorException in routes.php line 16:
Call to undefined method Illuminate\Routing\Route::get()
in routes.php line 16
这是我的 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;
您实际上不必导入任何 class,因为 Laravel 注册了全局别名 Route
。
如果要导入右边的class,那就是:
use Illuminate\Support\Facades\Route;
Laravel VERSION = '5.2.30'
使用 zendserver enterprise
在 C:\Program Files (x86)\Zend\ZendServer\data\plugins\laravel\zray\ZRay.php
来自 zend 服务器,更改第 193 行
来自
if (get_class($route) != 'Illuminate\Routing\Route') {
到
if (get_class($route) != 'Illuminate\Support\Facades\Route') {
对此发表评论:
// use Symfony\Component\Routing\Route;
使用这个:
use Illuminate\Support\Facades\Route;
我刚刚安装了 Laravel 5.1,访问了我的应用程序的主页,但出现以下错误:
Whoops, looks like something went wrong.
1/1
FatalErrorException in routes.php line 16:
Call to undefined method Illuminate\Routing\Route::get()
in routes.php line 16
这是我的 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;
您实际上不必导入任何 class,因为 Laravel 注册了全局别名 Route
。
如果要导入右边的class,那就是:
use Illuminate\Support\Facades\Route;
Laravel VERSION = '5.2.30'
使用 zendserver enterprise
在 C:\Program Files (x86)\Zend\ZendServer\data\plugins\laravel\zray\ZRay.php
来自 zend 服务器,更改第 193 行
来自
if (get_class($route) != 'Illuminate\Routing\Route') {
到
if (get_class($route) != 'Illuminate\Support\Facades\Route') {
对此发表评论:
// use Symfony\Component\Routing\Route;
使用这个:
use Illuminate\Support\Facades\Route;