• <tfoot id='9j9Pw'></tfoot>

    <i id='9j9Pw'><tr id='9j9Pw'><dt id='9j9Pw'><q id='9j9Pw'><span id='9j9Pw'><b id='9j9Pw'><form id='9j9Pw'><ins id='9j9Pw'></ins><ul id='9j9Pw'></ul><sub id='9j9Pw'></sub></form><legend id='9j9Pw'></legend><bdo id='9j9Pw'><pre id='9j9Pw'><center id='9j9Pw'></center></pre></bdo></b><th id='9j9Pw'></th></span></q></dt></tr></i><div id='9j9Pw'><tfoot id='9j9Pw'></tfoot><dl id='9j9Pw'><fieldset id='9j9Pw'></fieldset></dl></div>
      <bdo id='9j9Pw'></bdo><ul id='9j9Pw'></ul>

  • <small id='9j9Pw'></small><noframes id='9j9Pw'>

    <legend id='9j9Pw'><style id='9j9Pw'><dir id='9j9Pw'><q id='9j9Pw'></q></dir></style></legend>

        在 Zend 框架中导出 csv

        export csv in zend framework(在 Zend 框架中导出 csv)

            <tfoot id='TWQoJ'></tfoot>

              <tbody id='TWQoJ'></tbody>
          1. <legend id='TWQoJ'><style id='TWQoJ'><dir id='TWQoJ'><q id='TWQoJ'></q></dir></style></legend>
            <i id='TWQoJ'><tr id='TWQoJ'><dt id='TWQoJ'><q id='TWQoJ'><span id='TWQoJ'><b id='TWQoJ'><form id='TWQoJ'><ins id='TWQoJ'></ins><ul id='TWQoJ'></ul><sub id='TWQoJ'></sub></form><legend id='TWQoJ'></legend><bdo id='TWQoJ'><pre id='TWQoJ'><center id='TWQoJ'></center></pre></bdo></b><th id='TWQoJ'></th></span></q></dt></tr></i><div id='TWQoJ'><tfoot id='TWQoJ'></tfoot><dl id='TWQoJ'><fieldset id='TWQoJ'></fieldset></dl></div>

              <small id='TWQoJ'></small><noframes id='TWQoJ'>

              • <bdo id='TWQoJ'></bdo><ul id='TWQoJ'></ul>

                  本文介绍了在 Zend 框架中导出 csv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试将数据库表导出为可从浏览器下载的 .csv.我的代码是基于 zend 框架的,我几乎可以通过以下操作实现:

                  I'm trying to export a database table as a .csv downloadable from the browser. My code is zend framework based and I'm almost there with the following action:

                  public function exportTableAction()
                  {
                      $this->_helper->layout->disableLayout();
                      $this->_helper->viewRenderer->setNoRender();
                  
                      $fileName = $this->_getParam('fileName');
                      $tableName = $this->_getParam('tableName');       
                  
                      header('Content-type: application/octet-stream');
                      header('Content-Disposition: attachment; filename="'.$fileName.'"');
                  
                      echo $this->getCsv($tableName, $fileName);
                  }
                  

                  我可以下载包含有效数据的 .csv 文件.但是,即使我禁用了布局和渲染器,我仍然会在 .csv 文件的末尾获得页面的页眉、侧边栏和页脚的输出.有没有办法禁用除我的 exportTableAction 中生成的输出之外的任何 html 输出?或者我可以用不同的方式将标题信息和 csv 字符串发送到浏览器吗?

                  I can download my .csv file containing valid data. However, even if I disabled the layout and the renderer, I still get the output of the header, sidebar, and footer of my page at the end of my .csv file. Is there a way to disable any html output other than the one generated in my exportTableAction? Or can I send the header information and the csv string to the browser in a different way?

                  顺便说一句:我正在使用操作堆栈插件来帮助我呈现标题和侧边栏,如下所示:

                  BTW: I'm using the action stack plugin to help me render the header and sidebar as follows:

                  ...
                  $actionStack = $front->getPlugin('Zend_Controller_Plugin_ActionStack');
                  $actionStack->pushStack($userlogAction);
                  $actionStack->pushStack($rightcolAction);
                  

                  干杯,阿德里安

                  推荐答案

                  我们找到了问题的解决方案.我替换了以下行

                  We found a solution to the problem. I replaced the following line

                  $this->_helper->viewRenderer->setNoRender();
                  

                  $this->_helper->viewRenderer->setNeverRender();
                  

                  如果使用 setNeverRender(),则不会渲染任何视图(也不来自插件).

                  If setNeverRender() is used, no views are rendered (from plugin neither).

                  这篇关于在 Zend 框架中导出 csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                        <tbody id='FXyWX'></tbody>
                      • <small id='FXyWX'></small><noframes id='FXyWX'>

                        <legend id='FXyWX'><style id='FXyWX'><dir id='FXyWX'><q id='FXyWX'></q></dir></style></legend>
                        • <bdo id='FXyWX'></bdo><ul id='FXyWX'></ul>
                          <tfoot id='FXyWX'></tfoot>

                          <i id='FXyWX'><tr id='FXyWX'><dt id='FXyWX'><q id='FXyWX'><span id='FXyWX'><b id='FXyWX'><form id='FXyWX'><ins id='FXyWX'></ins><ul id='FXyWX'></ul><sub id='FXyWX'></sub></form><legend id='FXyWX'></legend><bdo id='FXyWX'><pre id='FXyWX'><center id='FXyWX'></center></pre></bdo></b><th id='FXyWX'></th></span></q></dt></tr></i><div id='FXyWX'><tfoot id='FXyWX'></tfoot><dl id='FXyWX'><fieldset id='FXyWX'></fieldset></dl></div>