laravel 5:找不到类“输入" [英] laravel 5 : Class 'input' not found
本文介绍了laravel 5:找不到类“输入"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的routes.php
文件中,我有:
Route::get('/', function () {
return view('login');
});
Route::get('/index', function(){
return view('index');
});
Route::get('/register', function(){
return view('register');
});
Route::post('/register',function(){
$user = new \App\User;
$user->username = input::get('username');
$user->email = input::get('email');
$user->password = Hash::make(input::get('username'));
$user->designation = input::get('designation');
$user->save();
});
我有一张用户注册表格.我也在routes.php
中采用了输入值的形式.
I have a form for users registration. I am also taking the form inputs value in the routes.php
.
但是当我注册用户时出现错误. 错误:
But the error comes up when I register a user . Error:
FatalErrorException in routes.php line 61:
Class 'input' not found
推荐答案
它是Input
而不是input
.
此提交从config/app.php
中删除了Input
门面定义,因此您必须手动将其添加到aliases
数组如下,
It is Input
and not input
.
This commit removed Input
facade definition from config/app.php
hence you have to manually add that in to aliases
array as below,
'Input' => Illuminate\Support\Facades\Input::class,
或者您可以根据需要直接导入Input
门面
Or You can import Input
facade directly as required,
use Illuminate\Support\Facades\Input;
这篇关于laravel 5:找不到类“输入"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文