直接上项目地址吧:
https://github.com/PHPOffice/PHPWord#getting-started
Installation(安装)
PHPWord is installed via Composer. To add a dependency to PHPWord in your project, either
Run the following to use the latest stable version(第一种安装方法)
composer require phpoffice/phpword
or if you want the latest master version(第二种安装方法)
composer require phpoffice/phpword:dev-master
You can of course also manually edit your composer.json file(第三种安装方法)
{
"require": {
"phpoffice/phpword": "v0.14.*"
}
}
Getting started(使用,一句话就搞定)
<?php
require_once './vendor/autoload.php';
use PhpOffice\PhpWord\TemplateProcessor;
$templateProcessor = new TemplateProcessor('./Template.docx');
$templateProcessor->setValue('this_is_player', "小牛逼");
$templateProcessor->saveAs('./helloWorld.docx');
模板如下(Template.docx),红框中的文本就是要替换的。
搜索
标签
study
ab
amap
apache
apahe
awk
aws
bat
centos
CFS
chrome
cmd
cnpm
composer
consul
crontab
css
curl
cygwin
devops
di
docker
docker,docker-compose
ethereum
excel
fiddler
fluentd
framework
front-end
git
gitgui
github
glide
go
golang
gorm
grafana
gzip
ioc
item2
iterm2
javascript
jenkins
jsonp
kafka
laradock
laravel
larval
linux
liunux
log
mac
mac, wi-fi
macos
magento
mariaDB
minikube
mongoDB
msp
mysql
netbeans
nginx
nodejs
nohup
npm
nsq
php
php-fpm
php7
phpstorm
php扩展
Protobuf
python
redis
scp
server
shell
soap
socket
socket5
sql
sre
ssdb
ssh
ssl
study
sublime
swift
system
td-agent
uml
v2ray
vagrant
vagrnat
vim
vpn
vue
vue.js
webpack
webrtc
websocket
webtatic
windows
windows7
word
wps
xdebug
yarn
yii2
yum
zookeeper
世界国家
互联网
以太坊
分类
前端
小程序
打印机
排序算法
搞笑
权限
粤语
缓存
网络
虚拟机
视频
设计模式
项目管理
热门文章
友情链接