当前位置:网站首页>Solution to the prompt of could not close zip file during phpword use
Solution to the prompt of could not close zip file during phpword use
2022-07-05 13:42:00 【Zi Mu Lei】
lately thinkphp The project needs to use phpword To generate a docx The file of , Which USES phpword, First of all, let's say something about it phpword Installation and basic use of .
One 、phpword install
phpword It's through composer To install dependencies , Directly run the following code into the project directory
composer require phpoffice/phpword
Two 、 Basic operation method ( Template replacement )
<?php
namespace Home\Controller;
use Think\Controller;
use PhpOffice\PhpWord\TemplateProcessor;
require_once 'C:\wamp64\www\wenjiantest\ThinkPHP\Library\vendor\autoload.php';
//******//composer After installation autoload.php, Note that the path must be accurate
class DocumentController extends Controller{
public function index(){
$temp=new TemplateProcessor('C:\wamp64\www\wenjiantest\ThinkPHP\Library\vendor\templatee.docx');
$temp->setValue('user', ' Lei Feng's Lei ');
$temp->setValue('email', '[email protected]');
$temp->saveAs("test.docx");
}
}
3、 ... and 、 The main items
Today's point is this , Always prompt when doing the test Could not close zip file, I searched some solutions on the Internet , because phpword It is rarely used in China , So there is no accurate solution , Most of them say that the memory is full 、 Folder permissions and other issues , After adjustment, the same prompt remains , In fact, the problem is docx There is a problem writing the version of the template , Specific solutions :
Add template file template.doc Save as template.docx( Remember not to change the suffix directly , use word Open and save as docx It works )
I hope you can avoid pitfalls in the future development process .
边栏推荐
- Rocky basic command 3
- MATLAB论文图表标准格式输出(干货)
- Godson 2nd generation burn PMON and reload system
- C object storage
- Data Lake (VII): Iceberg concept and review what is a data Lake
- Android本地Sqlite数据库的备份和还原
- Binder communication process and servicemanager creation process
- Flutter draws animation effects of wave movement, curves and line graphs
- Integer = = the comparison will unpack automatically. This variable cannot be assigned empty
- Go string operation
猜你喜欢
"Baidu Cup" CTF competition in September, web:sql
Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
MySQL --- 数据库查询 - 排序查询、分页查询
How to apply the updated fluent 3.0 to applet development
百度杯”CTF比赛 2017 二月场,Web:爆破-2
zabbix 监控
[daily question] 1200 Minimum absolute difference
MMSeg——Mutli-view时序数据检查与可视化
Idea设置方法注释和类注释
Flutter 3.0更新后如何应用到小程序开发中
随机推荐
Prefix, infix, suffix expression "recommended collection"
[深度学习论文笔记]使用多模态MR成像分割脑肿瘤的HNF-Netv2
MySQL get time
一文详解ASCII码,Unicode与utf-8
Flutter draws animation effects of wave movement, curves and line graphs
【Hot100】33. 搜索旋转排序数组
Can and can FD
不知道这4种缓存模式,敢说懂缓存吗?
My colleague didn't understand selenium for half a month, so I figured it out for him in half an hour! Easily showed a wave of operations of climbing Taobao [easy to understand]
How to choose note taking software? Comparison and evaluation of notion, flowus and WOLAI
Address book (linked list implementation)
[server data recovery] a case of RAID5 data recovery stored in a brand of server
redis6数据类型及操作总结
ELFK部署
web3.eth. Filter related
Integer ==比较会自动拆箱 该变量不能赋值为空
Apicloud studio3 WiFi real machine synchronization and WiFi real machine preview instructions
53. 最大子数组和:给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
These 18 websites can make your page background cool
redis6事务和锁机制