将字符串传递到 codeigniter 的下载帮助程序时如何创建换行符
将字符串传递到 codeigniter 的下载帮助程序时如何创建换行符。我尝试了下面的代码,它成功下载了文件和字符串,但它只是直接输出 \r\n
而不是将它们转换为新行。任何帮助将不胜感激:
$reportOutput = '';
foreach($data['displayPostingRecords'] as $result)
{
$reportOutput .= rawurldecode($result['wpPostlink']).' \r\n ';
}
//download the file..
$fileName = 'report-articleBatchID-'.$articleBatchID.'.txt';
$this->load->helper('download');
force_download($fileName, $reportOutput);
How do I create line breaks when passing a string into codeigniter's download helper. I have tried the code below which succesfully downloads the file and the string but it just outputs directly the \r\n
rather than converting them into new lines. Any help would be greatly appreciated:
$reportOutput = '';
foreach($data['displayPostingRecords'] as $result)
{
$reportOutput .= rawurldecode($result['wpPostlink']).' \r\n ';
}
//download the file..
$fileName = 'report-articleBatchID-'.$articleBatchID.'.txt';
$this->load->helper('download');
force_download($fileName, $reportOutput);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,漫长的一天...将单引号更改为常规引号,这将解决您的问题。
Sorry long day... change the single tick quotes to regular quotes and that'll fix your problem.