我正在将数据从我的控制器传递到我的刀片文件,然后想将刀片文件导出到 word 文档,到目前为止一切都被控制了,我可以将刀片导出到 word 文档,问题是该文档没有在 Microsoft Word 中打开说“单词在 1.docx 中发现不可读的内容”。下面是我正在使用的代码
$view = View::make('advertisement.advt_template.template_dr')->with('advtData', $advtData->first())->render();
$file_name = strtotime(date('Y-m-d H:i:s')) . '_advertisement_template.docx';
$headers = array(
"Content-type"=>"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"Content-Disposition"=>"attachment;Filename=$file_name"
);
return response()->make($view, 200, $headers);
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激