laravel中get()和all()之间的区别

Muh*_*eel 12 php laravel laravel-4

这两个人在laravel中有什么区别

$input = Input::get();
Run Code Online (Sandbox Code Playgroud)

$input = Input::all();
Run Code Online (Sandbox Code Playgroud)

我应该选择哪一个.

juc*_*uco 15

取自laravel来源:

public static function all()
{
   $input = array_merge(static::get(), static::query(), static::file());
   // ....
   return $input;
}
Run Code Online (Sandbox Code Playgroud)

所以all()调用get()和返回它的内容与一起query(),并file()在$ _FILES超级全局.

偏好显然取决于环境.我个人选择使用,Input::get($key, $default)因为我通常知道我在追求什么.