Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在word文件中转换文本?它没有打开,有人能帮我吗?_Php_Laravel_Laravel 5 - Fatal编程技术网

Php 如何在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 =

我在拉拉维尔造了一个街区 我在textarea中使用ckeditor,并使用Laravel以word Format下载该文本文件,但它未打开,并给出错误XML解析错误

我下载word文件

   $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打开我下载的文件

有人能帮我吗?有人能帮我吗??