Php 如何在word文件中转换文本?它没有打开,有人能帮我吗?
我在拉拉维尔造了一个街区 我在textarea中使用ckeditor,并使用Laravel以word Format下载该文本文件,但它未打开,并给出错误XML解析错误 我下载word文件Php 如何在word文件中转换文本?它没有打开,有人能帮我吗?,php,laravel,laravel-5,Php,Laravel,Laravel 5,我在拉拉维尔造了一个街区 我在textarea中使用ckeditor,并使用Laravel以word Format下载该文本文件,但它未打开,并给出错误XML解析错误 我下载word文件 $data= Templete::where('id',$id)->first(); $wordTest= new \PhpOffice\PhpWord\PhpWord(); $newSection= $wordTest->addSection(); $wordText =
$data= Templete::where('id',$id)->first();
$wordTest= new \PhpOffice\PhpWord\PhpWord();
$newSection= $wordTest->addSection();
$wordText = $data['word'];
$newSection->addText($wordText);
$objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordTest,'Word2007');
try
{
$objectWriter->save(storage_path('TestWordFile.docx'));
}
catch(Exception $e) {
}
return response()->download(storage_path('TestWordFile.docx'));
// Templete::where('id',$id)->delete();
session()->flash('message','file download ');
return redirect()->to('/text');
我想用word打开我下载的文件有人能帮我吗?有人能帮我吗??