How to check if $_GET
is empty?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
why do you need such a checking?
lol
you guys too direct-minded.
don't take as offense but sometimes not-minded at all
$_GET is very special variable, not like others.
it is supposed to be always set. no need to treat it as other variables. when $_GET is not set and it's expected - it is emergency case and that's what "Undefined variable" notice invented for
You said it yourself, check that it's
empty
:See, PHP is so straightforward. You may simply write, what you think ;)
This method is quite secure.
!$_GET
could give you an undefined variable E_NOTICE if$_GET
was unset (not probable, but possible).