Файл лезвия Laravel в документ WordPhp

Кемеровские программисты php общаются здесь
Anonymous
Файл лезвия Laravel в документ Word

Сообщение Anonymous »

Я передаю данные из моего контроллера в мой файл лезвия, а затем хочу экспортировать файл лезвия в документ Word, до сих пор все контролируется, я могу экспортировать лезвие в документ Word, проблема заключается в том, что документ не открывается в Microsoft Word. «Слово найдено нечитаемое контент в 1.docx». Ниже приведен код, который я использую < /p>

Код: Выделить всё

$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);
  • I am passing data to blade and then storing all information in a variable
  • creating a file name for reference
  • creating headers to be used when downloading file
  • making the response with blade content variable and header information
Любая помощь будет оценена < /p>

Подробнее здесь: https://stackoverflow.com/questions/573 ... d-document

Вернуться в «Php»