Cakephp Form Helper ..奇怪的行为

时间:2012-06-01 07:55:14

标签: forms cakephp formhelper

我在几个观点中使用Form Helper类,我的行为非常奇怪。

例如,这是一个非常简单的观点:

<div class="users index">
    <h2>Users</h2>
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th>id</th>
            <th>name</th>
            <th>username</th>
            <th>email</th>
            <th>role</th>
            <th class="actions">Actions</th>
        </tr>
        <?php
        $i = 0;
        foreach ($users as $user):
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
            ?>
            <tr<?php echo $class; ?>>
                <td><?php echo $user['User']['id']; ?>&nbsp;</td>
                <td><?php echo $user['User']['name']; ?>&nbsp;</td>
                <td><?php echo $user['User']['username']; ?>&nbsp;</td>
                <td><?php echo $user['User']['email']; ?>&nbsp;</td>
                <td><?php echo "Role" ?>&nbsp;</td>
                <td class="actions">
                    <?php echo $this->Html->link('View', array('action' => 'view', $user['User']['id'])); ?>
                    <?php echo $this->Html->link('Edit', array('action' => 'edit', $user['User']['id'])); ?>
                    <?php echo $this->Form->postLink('Delete', array('action' => 'delete', $user['User']['id']), array('confirm' => 'Are you sure you want to delete this user?')); ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>
</div>

如果users数组有超过5条记录,那么我会在标记的最后收到一条非常奇怪的</字符串。

使用大型表单时,我注意到了这种相同的行为。在一些场之后,这条奇怪的弦再次出现。

我可以测试任何东西以确定问题。

由于

0 个答案:

没有答案
相关问题