私は一般的にphpとcakePhpから始めたばかりです。ブログ チュートリアルを実装しようとしたときに、次のエラーが発生しました。
ここまでチュートリアルの手順に従いましたhttp://book.cakephp.org/2.0/en/getting-started.html#creating-post-views
エラーメッセージのスクリーンショットはこちら-
[1]: http://i.imgur.com/xLvz3.png "上"
[2]: http://i.imgur.com/cJHPK.png "下"
モデル/Post.php
<?php
class Post extends AppModel {}
コントローラー/PostsController.php
<?php
class PostsController extends AppController {
public $helpers = array(’Html’, ’Form’);
public function index() {
$this->set(’posts’, $this->Post->find(’all’));
}
public function view($id = null) {
$this->Post->id = $id;
$this->set(’post’, $this->Post->read());
}}
投稿/index.ctp
<h1>Blog posts</h1>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Created</th>
</tr>
<!-- Here is where we loop through our $posts array, printing out post info -->
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Post']['id']; ?></td>
<td>
<?php echo $this->Html->link($post['Post']['title'],
array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); ?>
</td>
<td><?php echo $post['Post']['created']; ?></td>
</tr>
<?php endforeach; ?>
<?php unset($post); ?>