开发者

How to send correct headers for Excel file in a Zend Framework Response

I am having issue with setting headers for xls file while downloading through Zend Framework.

I have tried this but not working...

$this->getResponse()
         ->setHeader('Content-type', 'application/vnd.ms-excel')
         ->setHeader('Content-Disposition', 'attachment; filenam开发者_StackOverflowe=test.xls');

Still it shows some binary data. and not setting headers.

Please help me though this.


Try

->setHeader('Content-type', 'application/vnd.ms-excel', true)

Use true in the third argument to force replacement of the header

and add

->setHeader('Content-Length', ...)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜