跨多个文件使用PHP常量时出错

Here is the error I get in file 'b':

Notice: Use of undefined constant SITE_STATUS - assumed 'SITE_STATUS'

I have file 'a' with:

if ($_SERVER['HTTP_HOST'] == 'localhost') {
defined('SITE_STATUS') or define('SITE_STATUS', "dev");
} elseif ($_SERVER['HTTP_HOST'] == 'dev.xxx.com') {
defined('SITE_STATUS') or define('SITE_STATUS', "dev-remote");
}

and file 'b' is:

    if (SITE_STATUS == 'dev') {
    $prefix = "/020";
} elseif (SITE_STATUS == 'dev-remote') {
    $prefix = "";
}

In file 'a' require_once file 'b' is after the constants get defined.

File 'b' is not recognizing the constant set in file 'a'. Am I doing something wrong?

EDIT: Works fine on page 'a'

EDIT2: On page 'b' if I type before the if statements die(SITE_STATUS) I can see on the page 'dev' which means the constant is still defined.

You may try this:

if ($_SERVER['HTTP_HOST'] == 'localhost') 
{
    defined('SITE_STATUS') or define('SITE_STATUS', "dev");
} 
elseif ($_SERVER['HTTP_HOST'] == 'dev.xxx.com') 
{
    defined('SITE_STATUS') or define('SITE_STATUS', "dev-remote");
}
// add else
else 
{
    echo "I was not expecting you here :o ".$_SERVER['HTTP_HOST'];
}