致命错误:function is undefined |函数仍然在做它的工作


Fatal Errror: function is undefined | The function still does its job though?

我得到一个函数的致命错误,被清除定义并正常工作。即使它做了它的工作,它仍然说它是"未定义的"。有人经历过吗?

/include/adminbar.php

<?php if (is_logged_in()) : ?>
    <div id="globaluserbar" class="gobaluseradminbar" style="position:fixed; top:0px; left:0px; background:#292929; height:42px; width:100%; color:white; vertical-align:middle;">This is the adminbar</div>
<?php endif; ?>

//

显然也包括
function is_logged_in(){
        if (!empty($_SESSION[SESSION_IS_LOGGEDIN]) && $_SESSION[SESSION_IS_LOGGEDIN] == 1) {
            return true;
        } 
    }
function theme_header(){
    include URLBASE."/includes/theme-inc/head.php";
    include URLBASE."/content/themes/default/header.php";
}
function theme_footer(){
    include URLBASE."/content/themes/default/footer.php"; 
    include URLBASE."/includes/adminbar.php";
    include URLBASE."/includes/theme-inc/foot.php";
}

/index . php

<?php theme_header(); ?>
<p>This is the main index!</p>
<?php theme_footer(); ?>

所有其他的东西都不应该有因子。

显示index.php中

的错误状态

致命错误:调用未定义函数is_logged_in()在C:'xampp'htdocs'ionz'2.0'包括'adminbar.php在第1行

如果两个函数在同一个类中,您将看到这一点,在这种情况下,您需要编写:

if ($this->is_logged_in())

或者您可能在某处丢失了一个大括号,这将使您的函数成为嵌套函数。再看看这个问题:调用未定义函数