-1

定義がクリアされ、正しく動作している関数に対して致命的なエラーが発生します。ジョブは実行されますが、まだ「未定義」であると表示されます。誰もそれを経験したことがありますか?

/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; ?>

/include/functions.php

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でそれを述べています

致命的なエラー: 1 行目の C:\xampp\htdocs\ionz\2.0\includes\adminbar.php の未定義関数 is_logged_in() の呼び出し

4

1 に答える 1

0

これは、両方の関数が同じクラスにある場合に表示されます。その場合、次のように記述する必要があります。

if ($this->is_logged_in())

または、関数がネストされた関数になる中括弧がどこかにない可能性があります。この問題も見てください: PHP Call to undefined function

于 2015-06-09T23:26:56.900 に答える