请求类别之间的差异 [英] Differences between Request classes

查看:89
本文介绍了请求类别之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Laravel 5.1具有以下类,它们似乎具有相同的名称,而某些类具有相似的行为.

Laravel 5.1 has the following classes that seems to share the same name and some have similar behavior.

use App\Http\Requests\Request;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Input;

Request类之间有什么区别?什么时候应该使用每个类?

What are the differences between the Request classes and when should we use each class?

推荐答案

如果您查看 http://laravel.com/docs/5.1/facades 您会看到 Input 门面和 Request 门面都是该类的门面:

If you look at http://laravel.com/docs/5.1/facades you see that both the Input facade as the Request facade are facades of the class:

Illuminate\Http\Request

您正在谈论的App \ Http \ Requests \ Request是同一类. 在请求和输入"外观中有一个细微的差别.请参阅此帖子,以了解确切的差异 https://stackoverflow.com/a/29961400/1129489

The App\Http\Requests\Request you're talking about is the same class. There is one minor difference in the facades for Request and Input. See this post about the exact difference https://stackoverflow.com/a/29961400/1129489

这篇关于请求类别之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆