PHP替换Word文档中的变量
我有一个包含某些变量的Word文档(例如字符串$$title$$)。现在我想在 PHP 中打开这个 word 文档,并将字符串 $$title$$ 替换为我从数据库中读取的字符串。最后一步是保存此 Word 文档并将其提供给用户下载。
替换字符串并开始下载就没有问题了。但我不知道如何将单词内容放入 php 中的变量中,使用该变量,然后将其保存到新的单词文档中。
你们中有人知道一个很好的 PHP 类,它提供了对编辑 Word 文档内容的支持吗? (如果必须的话,我可以接受 OpenXML 格式)
I have a word document that contains certain variables (for example the string $$title$$). Now I want to open this word document in PHP and replace the string $$title$$ with a string I read out of the database. Final step would be to save this word document and give it to the user for download.
Replacing the string and start the download is no problem. But I don't know how I can get the word content into a variable in php, work with that variable and then save it to a new word document.
Does any one of you know a good PHP class that provides support for editing the contents of a word document? (I'm fine with OpenXML formats if it has to be)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试过 PHPWord 吗?我一直在同一站点使用 PHPExcel,它是一个很棒的库。
Have you tried PHPWord? I've been using PHPExcel from the same site and it is great library.