PHP code example of cshaptx4869 / html2word
1. Go to this page and download the library: Download cshaptx4869/html2word library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cshaptx4869 / html2word example snippets
airy\Html2WordMaker;
use Fairy\MhtFileMaker;
// 1、保存为文件
Html2WordMaker::getInstance()
->addFile('resource/tpl.html')
->eraseLink()
->fetchImg('http://php.test/html2word')
->makeFile('resource/a.doc');
MhtFileMaker::getInstance()
->addFile('resource/tpl.html')
->eraseLink()
->fetchImg('http://php.test/html2word')
->makeFile('resource/a.doc');
// 2、浏览器下载
Html2WordMaker::getInstance()
->addFile('resource/tpl.html')
->fetchImg('http://php.test/html2word')
->download();
MhtFileMaker::getInstance()
->addFile('resource/tpl.html')
->fetchImg('http://php.test/html2word')
->download();