开发者

Novice parse error T_DOUBLE_ARROW [closed]

This qu开发者_如何学Cestion is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I'm starting to make my first steps into CakePHP 1.3, and I'm having a parse error I can't find. I'm trying the main tutorial and encountering this error:

Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ')' in /Applications/XAMPP/xamppfiles/htdocs/mysite.com/app/views/posts/index.ctp on line 11

the file affected is:

<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>

Where am I wrong?


In this line

 <td><?php echo $this->Html->link($post['Post']['title'], array ('controller', => 'posts', 'action' => 'view', $post['Post']['id'])); ?></td>

you need to remove the , after controller.

And I think you need to add an ) after ´view´

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜