当前位置:网站首页>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/phpwordTwo 、 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 .
边栏推荐
- 今年上半年,通信行业发生了哪些事?
- go map
- mysql econnreset_ Nodejs socket error handling error: read econnreset
- Basic characteristics and isolation level of transactions
- leetcode 10. Regular expression matching regular expression matching (difficult)
- 49. 字母异位词分组:给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。 字母异位词 是由重新排列源单词的字母得到的一个新单词,所有源单词中的字母通常恰好只用一次。
- Matlab paper chart standard format output (dry goods)
- 研究生可以不用学英语?只要考研英语或六级分数高!
- 华为推送服务内容,阅读笔记
- 南理工在线交流群
猜你喜欢

RK3566添加LED

Shandong University Summer Training - 20220620

Summit review | baowanda - an integrated data security protection system driven by compliance and security

Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications

Idea set method annotation and class annotation

SAE international strategic investment geometry partner

TortoiseSVN使用情形、安装与使用

Idea设置方法注释和类注释

What is a network port

真正的缓存之王,Google Guava 只是弟弟
随机推荐
53. 最大子数组和:给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
Difference between avc1 and H264
redis6主从复制及集群
“百度杯”CTF比赛 九月场,Web:Upload
内网穿透工具 netapp
Interviewer soul torture: why does the code specification require SQL statements not to have too many joins?
Clock cycle
华为推送服务内容,阅读笔记
Personal component - message prompt
Rocky basic command 3
【每日一题】1200. 最小绝对差
【华南理工大学】考研初试复试资料分享
With 4 years of working experience, you can't tell five ways of communication between multithreads. Dare you believe it?
Integer = = the comparison will unpack automatically. This variable cannot be assigned empty
Prefix, infix, suffix expression "recommended collection"
嵌入式软件架构设计-消息交互
leetcode 10. Regular Expression Matching 正则表达式匹配 (困难)
Idea set method annotation and class annotation
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]
Parsing XML using Dom4j