i have this request method:
if (!$_REQUEST['0']) {
echo "Address missing...";
die();
} else {
code
code etc.
}
And address is: http://localhost/api.php?0=address
If I open: api.php?0=0 I should get another error which says address doesn’t correct. But I get Address missing… In my opinion something wrong with:
if (!$_REQUEST['0'])
Any ideas?
You’re checking if $_REQUEST[‘0’] is false. In PHP (and many other languages), 0 stands for false. Because 0 == false, your expression results in ‘true’ and the
echoanddie()are executed.If you are trying to test if $_REQUEST[‘0’] exists, you should use isset() or empty()