Error occurred in word template for phpword operation: ZipArchive::getFromName ().

phpword reported an error when operating the word template: ZipArchive::getFromName (): Invalid or uninitialized Zip object means invalid or uninitialized ZIP objects, as shown in the following figure (which I wrote in the laravel framework)

clipboard.png

clipboard.png

it is useless to try to install the php_zip.dll extension. Baidu has no effect for many times. I am looking for a handsome and powerful person to answer. Thank you very much!

Mar.18,2021

happens to encounter this problem. Share the solution.
1. File type problem, word template file is saved to another format. Such as .docx
2. Check whether php has permission to open the template file
3. Check whether php has permission to manipulate tmp system cache files


the server also installs zip unzip extensions


whether your doc file is in a compressed package or a separate file
if it is a separate file, there is no need for compression and decompression at all, that is, there is no need for zip-related functions at all.
if it is a compressed package, it is a compressed package format of zip,tar,rar. Different formats and different encryption methods will result in different decompression
if it is zip compression. First confirm whether your PHP has a zip-related extension php-m or phpinfo () can view to
if there is a zip extension, it is recommended to test the zip-related operations in another place and integrate it into the project

finally, there may be a problem with the word version. Try the old version

.

have you solved this? this problem also occurs when I use thinkphp to use phpword. Many people on the Internet say that EXCEL2007 is replaced with EXCEL5, but what we use is word, has nothing to do with excel.
the template you use, I use phpword to read word content also report this error

Menu