沃梦达 / 编程问答 / php问题 / 正文

laravel 5:找不到“输入"类

laravel 5 : Class #39;input#39; not found(laravel 5:找不到“输入类)

本文介绍了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 AppUser;
    $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外观定义code> 因此您必须手动将其添加到 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' => IlluminateSupportFacadesInput::class,

或者您可以根据需要直接导入Input Facade,

Or You can import Input facade directly as required,

use IlluminateSupportFacadesInput;

这篇关于laravel 5:找不到“输入"类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:laravel 5:找不到“输入"类

基础教程推荐