Zend viewRenderer->setNeverRender();
我基本上是想按照描述从 ZEND 导出到 csv 在 zend 框架中导出 csv
并使用 $this->_helper- >viewRenderer->setNeverRender();
不幸的是,插件代码仍然包含在 csv 文件中。 有什么线索吗?
public function indexAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNeverRender();
$filename = "Test".'-'.date('Ymd').'.csv';
header("Content-type: text/csv; charset=UTF-8; header=present");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
mb_internal_encoding("UTF-8");
mb_http_output("UTF-8");
//foreach ($data as $record) {
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
}
I am basically trying to export from ZEND to csv as described
export csv in zend framework
and use the $this->_helper->viewRenderer->setNeverRender();
unfortunately the plugin code is still contained in the csv file.
Any clue why?
public function indexAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNeverRender();
$filename = "Test".'-'.date('Ymd').'.csv';
header("Content-type: text/csv; charset=UTF-8; header=present");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
mb_internal_encoding("UTF-8");
mb_http_output("UTF-8");
//foreach ($data as $record) {
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信该方法称为“setNoRender()”...
QuickNDirty 解决方案(正如我所见,您不使用视图)是在所有回显完成后“die()”:P
I believe the method is called "setNoRender()"...
QuickNDirty solution (as I see you don't use view) is to "die()" after all the echoing is finished :P