我开始进入CakePHP 1.3的第一步,我遇到了一个我找不到的解析错误。我正在尝试main tutorial并遇到此错误:
在第11行的/Applications/XAMPP/xamppfiles/htdocs/mysite.com/app/views/posts/index.ctp中解析错误:语法错误,意外的T_DOUBLE_ARROW,期待')'
受影响的文件是:
<h1>Posts</h1>
<table>
<tr>
<th>ID</th>
<th>Title</th>
<th>Creation date</th>
</tr>
<?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; ?>
</table>
我哪里错了?
答案 0 :(得分:4)
在这一行
<td><?php echo $this->Html->link($post['Post']['title'], array ('controller', => 'posts', 'action' => 'view', $post['Post']['id'])); ?></td>
你需要删除控制器后的。
我想你需要在'view'之后添加一个