I am using laravel 5.2. I have a question. If I send a request like
http://localhost/test?sports[]=soccer&sports[]=basketball
I can get sports as an array with 2 elements.
But if I send request like:
http://localhost/test?sports[]
I get it by $sports = $request->input('sports'), I think it is an empty array, but it's actually not. I var_dump() it:
array(1) { [0]=> string(0) "" }
So someone can tell me how can I determine the request input array data is empty?
Supplement:
My routes.php here:
Route::get('/test',function(Illuminate\Http\Request $request){
var_dump($request->has('sports'));
});
I access http://localhost/test?sports[]
It output true.
$request->has('sports')check the output should be false.