我对YII框架很新,所以请耐心等待。 =) 这是我的代码。
public function actionList()
{
$Employee = new employee;
$data = array('employee' => $Employee);
$this->render('Employee_Display', $data);
}
<tbody>
<tr>
<?php foreach($employee as $row): ?>
<td><?php $row['employee_firstname']; ?></td>
<?php endforeach; ?>
</tr>
</tbody>
我想获取员工姓名列表并以表格形式显示。
答案 0 :(得分:1)
public function actionList()
{
$Employee = employee::model()->findAll();
$data = array('employee' => $Employee);
$this->render('Employee_Display', $data);
}
<tbody>
<tr>
<?php foreach($employee as $row): ?>
<td><?php $row->employee_firstname; ?></td>
<?php endforeach; ?>
</tr>
</tbody>