Class 'Illuminate\Support\Facades\Input' not found

前端 未结 11 1777
生来不讨喜
生来不讨喜 2021-01-12 05:14

I have an error when upgrading laravel 6

Symfony \\ Component \\ Debug \\ Exception \\ FatalThrowableError (E_ERROR) Class \'Illuminate\\Support\\F

11条回答
  •  再見小時候
    2021-01-12 05:48

    if you're using less version of Laravel 5.2

    In config/app.php, replace:

    'Input' => Illuminate\Support\Facades\Input::class,
    

    Or You can import Input facade directly as required,

    use Illuminate\Support\Facades\Input;
    

    In Laravel 5.2 Input:: is replaced with Request::

    use

    Request::
    

    Add to the top of Controller or any other Class

    use Illuminate\Http\Request;
    

    In your case

    $image_tmp = $request->image;
    $fileName = time() . '.'.$image_tmp->clientExtension();
    

    Laravel 6X The Input facade, which was primarily a duplicate of the Request facade, has been removed. If you are using the Input::get method, you should now call the Request::input method. All other calls to the Input facade may simply be updated to use the Request facade.

    You can directly use $request as well

    $request->all();
    

提交回复
热议问题