错误:1找不到帮助程序.-结块



我正在尝试为内容模型控制器创建一个索引方法,但我收到了以下错误,我在这里搜索了一下,但没有找到相关的答案。请查看以下代码和屏幕截图:

Content.php:

class Content extends AppModel{
   public $name = 'Content';
}

ContentsController.hp:

class ContentsController extends AppController {
    public $name = 'Contents';
    public function index() {
        $this->set('Contents', $this->Content->find('all'));
    }
}

index.ctp:

<h1>View All Content</h1> 
<table>
     <tr>
         <th>ID</th>
         <th>Title</th>
         <th>Content</th>
     </tr>
     <?php foreach ($Contents as $content) : ?>
         <tr>
             <td><?php echo $this->$content['Content']['id']; ?></td>
             <td><?php echo $this->$content['Content']['title']; ?></td>
             <td><?php echo $this->$content['Content']['content']; ?></td>
         </tr>
     <?php endforeach; ?>
</table>

屏幕截图:http://postimg.org/image/sslcgoutx/

请帮助我,因为我是新的蛋糕和学习它。

在index.ctp 中尝试此操作

<h1>View All Content</h1> <table>
    <tr>
        <th>ID</th>
        <th>Title</th>
        <th>Content</th>
    </tr>
    <?php foreach ($Contents as $content) : ?>
        <tr>
            <td><?php echo $content['Content']['id']; ?></td>
            <td><?php echo $content['Content']['title']; ?></td>
            <td><?php echo $content['Content']['content']; ?></td>
        </tr>
    <?php endforeach; ?>
</table>

最新更新