PHPWORD
使用模板,批量生成Word。
使用模板,批量生成Word。
建立一个Word文件Template.docx
欲替换的值地方${name}
思路:
仿照smarty,
模板文件一定要命名为docx,后缀
前提,先下载开源类PHPWord,PHP开启ZIP拓展
<?php
require_once 'PHPWord.php';
$PHPWord = new PHPWord();
$document = $PHPWord->loadTemplate('Template.docx');
$document->setValue('name', 'xeay');
$document->setValue('class', '软件一班');
$document->setValue('No', '1108000xxxx');
$document->setValue('telephone', '1885022xxxx');
$document->setValue('why', 'ACM');
$document->setValue('signname', 'xeay');
$document->save('image.docx');
?>
- 上一篇:计算几分钟前、几小时前等
- 下一篇:前一任的神级代码,速来膜拜
精彩图集
精彩文章






