Export php form data to Excel or PDF
I have function called "resultAction" where I store all the information in $data to print in div table.
Now I want to export the same form data to excel. I want to pass the same form data to another function called "reportAction", where i failing to do that, i am returing the $data which fails.
function resultAction()
{
for ($i = 0; $i < count($result); $i++) {
$data[$i]['device_type'] = $result[$i]['device_type'];
$data[$i]['r开发者_开发问答egion_name'] = $result[$i]['region_name'];
}
echo Zend_Json::encode($data);
sleep(2);
$this->_helper->viewRenderer->setNoRender();
$this->_helper ->layout()->disableLayout();
return $data;
}
function reportAction() {
$res = $this ->resultAction // here it fails
}
You're looking for the forward function
function reportAction() {
$this->_forward('result'); // here it's not supposed to fail
}
精彩评论