$ _GET在非空时返回NULL

I have a link like this: http://localhost/edit.php?id=0

But, When I try to take the value like this: $id = $_GET['id'];

It returns null. Why it's happening? My code is like this:

<?php
public function loadEdit($hconn) {
    if (!empty($_GET['id'])) {
        $id = $_GET['id'];
        if ($this->isNumber($id) != true && !($id > 0)) {
            echo $id;
            header("Location: /goods.php");
        } else {
            //header("Location: /goods.php");
        }
    }
}

You're using if(!empty($_GET['id'])) { which will evaluate to false if $_GET['id'] has a value/string of zero.

Try using this instead:

if (isset($_GET['id'])) {

I recommend use:

if (array_key_exists('id', $_GET)) {