代码仓库:https://github.com/PHPOffice/PHPWord


1、进入/dayrui目录

2、使用命令行安装类


也可以使用迅睿的第三方类仓库:https://gitee.com/dayrui/composer,将下载的文件放到dayrui/Vendor/目录中。


3、需要将vendor目录命名为Vendor(首字母大写)

4、新建test.docx作为测试的模板文件,并设置变量

5、新建控制器文件:

dayrui/App/Demo/Controllers/Doc.php


5、访问url,即可生成test2.docx文件

index.php?s=demo&c=doc&m=index


本文地址:https://m.xunruicms.com/doc/1103.html