0

我第一次玩 codeigniter 和 ion auth。我已经完成了所有工作,但是在 ion auth 模板中,索引视图显示了所有用户的列表。

<?php foreach ($users as $user):?>
    <tr>
        <td><?php echo $user->first_name;?></td>
        <td><?php echo $user->last_name;?></td>
        <td><?php echo $user->email;?></td>
        <td>
            <?php foreach ($user->groups as $group):?>
                <?php echo anchor("auth/edit_group/".$group->id, $group->name) ;?><br />
            <?php endforeach?>
        </td>
        <td><?php echo ($user->active) ? anchor("auth/deactivate/".$user->id, 'Active') : anchor("auth/activate/". $user->id, 'Inactive');?></td>
        <td><?php echo anchor("auth/edit_user/".$user->id, 'Edit') ;?></td>
    </tr>
<?php endforeach;?>

通常 $users 数组将来自模型。但是在查看模型(ion_auth_model)时,我看不到任何特定于 $users 的内容。身份验证控制器也没有给我太多。

文档中, users() 函数是: $users = $this->ion_auth->users();

我认为这是在索引页上填充的数组。如果不在模型中,这将如何提取 MySQL 数据?这是如何运作的?

4

1 回答 1

1

@Smudger - 仔细看一下, ion_auth_model 有一个函数 users() 从第 1125 行开始(取决于你的版本),它接受一个可选的 $groups 参数

于 2013-02-26T11:20:45.710 回答