在模板中循环需要使用volist标签
控制器代码:
$user1['username'] = '张三';
$user2['username'] = '李四';
$user3['username'] = '王五';
$userList = array($user1,$user2,$user3);
$this->assign('userlist', $userList);