Php 未定义属性

Php 未定义属性,php,undefined,Php,Undefined,我得到以下错误。 我想不出这个代码有什么问题 有些事我错过了或忘记了。 谁能帮帮我吗?我现在陷入困境 他一直在说阵列有问题 Notice: Undefined property: Cms::$contant_types in C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php on line 34 Warning: in_array() expects parameter 2 to be array, null given in C:\xamp

我得到以下错误。 我想不出这个代码有什么问题

有些事我错过了或忘记了。 谁能帮帮我吗?我现在陷入困境

他一直在说阵列有问题

Notice: Undefined property: Cms::$contant_types in C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php on line 34

Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php on line 34

<?php

/*
    CMS Class
    Handle CMS task, allowing admins to view/edit content
*/

class Cms
{
    private $content_types = array('wysiwyg', 'textarea', 'oneline');
    private $FP;

    function __construct()
    {
        global $FP;
        $this->FP = &$FP;   
    }

    function clean_block_id($id)
    {
        $id = str_replace(' ', '_', $id);
        $id = str_replace('-', '_', $id);
        $id = preg_replace("/[^a-zA-Z0-9_]/", '',$id);
        return strtolower($id); 
    }

    function display_block($id, $type = 'wysiwyg')
    {
        // clean id
        $id = $this->clean_block_id($id);

        // check for valid type
        $type = strtolower(htmlentities($type, ENT_QUOTES));
        if (in_array($type, $this->contant_types) == FALSE)
        {
            echo "<script>alert('Please enter a valid block type for \'" . $id . "\'');</script>";
            return;
        }

        // get content
        $content = "content here...";

        // check login status
        if ($this->FP->Auth-checkLoginStatus())
        {
            if($type == 'wysiwyg') { $type2 = 'WYSIWYG';}
            if($type == 'textarea') { $type2 = 'Textarea';}
            if($type == 'oneline') { $type2 = 'One Line';}

            $edit_start = '<div class=""fp_edit>';
            $edit_type = '<a class="fp_edit_type" href="' . SITE_PATH .'app/cms/edit.php?id' . $id . '&type='. $type . '">' . $type2 . '</a>';
            $edit_link = '<a class="fp_edit_link" href="' . SITE_PATH .'app/cms/edit.php?id' . $id . '&type='. $type . '">Bewerken</a>';
            $edit_end = '</div>';

            echo $edit_start . $edit_type;
            echo $edit_link . $content . $edit_end;
        }
        else
        {
            echo $content;
        }
    }
}   
索引文件是

<?php include ("app/init.php");?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PassieCMS</title>
<link href="resources/css/style.css" rel="stylesheet" type="text/css">
<?php $FP->head(); ?>
</head>

<body class="home <?php $FP->body_class(); ?>">

    <?php $FP->toolbar(); ?>

    <div id="wrapper">
        <h1>Website</h1>

        <div id="banner">
            <img src="resources/images/banner.jpg" alt="banner" width="900" height="140">
        </div>

        <ul id="nav">
            <li><a href="#">Home</a></li>
            <li><a href="#">Test link</a></li>
            <li><a href="#">Longer Text Link</a></li>
            <li><a href="#">Contact us</a></li>
        </ul>

        <div id="content">
            <div class="left">
                <h2><?php $FP->Cms->display_block('content-header','oneline'); ?></h2>
                <?php $FP->Cms->display_block('content-maincontent'); ?>
            </div>
            <div class="right">
                <?php $FP->Cms->display_block('content-quote'); ?>
                <?php $FP->Cms->display_block('content-attribution'); ?>
            </div>
        </div>

        <div id="footer">
            Copyright 2014 PassieCMS | <?php $FP->login_link();?> <a href="app/login.php">Login optie 2</a>
        </div>

     </div>

</body>
</html>
谢谢大家抽出时间

if (in_array($type, $this->contant_types) == FALSE)
您有一个输入错误,您已将其声明为上面的内容类型。这应该起作用:

if (in_array($type, $this->content_types) == FALSE)

这就解决了问题并产生了一个新问题:P致命错误:在C:\xampp\htdocs\PassieCMS\app\cms\models\m_cms.php的第44oow行调用未定义的函数checkLoginStatus,我已经在代码中找到了一个我忘记了的>如果$this->FP->Auth checkLoginStatus,正确的是如果$this->->FP->Auth->checkLoginStatus