开发者

Export php form data to Excel or PDF

开发者 https://www.devze.com 2023-03-26 19:47 出处:网络
I have function called \"resultAction\" where I store all the information in $data to print in div table.

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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消