public function foo(Request $request)
{
$foo = $request->get('a');
$foo = $request->input('a');
}
Is there any difference between using get and input here?
某草草2017-05-16 16:55:54
It’s different.
After looking at input to get the array, I simply performed the fetch operation.
get has a more complete fetch mechanism, and there are also many exception-throwing operations.
For specific information, LZ can check the source code:
The input method is at: /vendor/laravel/framework/src/Illuminate/Http/Request.php
/vendor/laravel/framework/src/Illuminate/Http/Request.php
get方法在:/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php
The get method is at: /vendor /symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php
PS, I currently have 4.2