PHP空()不适合我

I have a URL like: https://website.org/withdraw.php?valid_addr=1333mwKE7EcwLaR9ztdtEt7pPEfafpW4nn&amount=0.0002&_unique=1

and A line of code that reads:

if (empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']))==0) exit();

If I remove the line then the code runs successfully. Can anyone tell me what I've done wrong.

The line is supposed to stop the code from running if any of the three fields are left empty.

Thanks.

Syntax Error. Remove the ==0) part:

if(empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique'])) {
    exit();
}

Left parenthesis missing,

   if ((empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']))==0) exit();

Try it...

I think you want to utilize array_key_exists rather than empty.

if (!array_key_exists('amount', $_GET) || 
    !array_key_exists('valid_addr', $_GET) ||
    !array_key_exists('_unique', $_GET))
    exit();

From PHP empty() docs

Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.

See Array Key Exists docs

You're code should be something like this:

if (empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']))
{
  exit();
}

Above your code has syntax error. I think you want to validate unique with 0 and 1. So you should have to try this code

if (empty($_GET['amount']) || empty($_GET['valid_addr']) || $_GET['_unique'])==0) exit();
if (($_GET['amount'] == 0) OR ($_GET['valid_addr'] == 0) OR ($_GET['_unique'] == 0)) { exit(); }