我是zend的新手,我不知道如何将数组提取到视图中(phtml)。
这是我的阵列:
[["0","Henedy"],["0","Samer"],["0","Walid"]]
这是我的控制器和我的模型表代码:
public function getUsersCoNbre()
{
$select = new Select();
$select->from('user');
$select->columns(array('*'));
$select->join(
'co_addi_info',
'user.pin = co_addi_info.user_pin',
array('co_nbre'),
'inner'
);
$statement = $this->tableGateway->getSql()->prepareStatementForSqlObject($select);
$resultSet = $statement->execute();
return $resultSet;
}
public function indexAction()
{
$users_co_nbre = iterator_to_array($this->getAddiinfoTable()->getUsersCoNbre());
// $jsonres = Json::encode($users_co_nbre);
// print_r($jsonres);die;
$view = new ViewModel();
$view->setTemplate('covoiturage/covoiturage/admin/statistics');
$view->setVariables(array(
'users_co_nbre' => $users_co_nbre,
));
return $view;
}