php解析doc格式word文件的另一种方法

来源:互联网 发布:数据分析师行业前景 编辑:程序博客网 时间:2024/05/18 05:39

原理是用php调用外部工具实现,用到的工具是antiword 

步骤1:下载解压antiword后,将antiword文件夹放到一个系统盘根目录下

步骤2:增加环境变量,我编写了一个批处理脚本,如下:

@echo off:: place为antiword所在盘符set place="e:":: 设置环境变量HOMEwmic ENVIRONMENT create name="HOME",username="<system>",VariableValue=%place%:: 添加Pathwmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;%HOME%"pause

步骤3:编写php脚本

<?php$file = "e:\antiword\ccc.doc";$content = shell_exec("e:\antiword\antiword –f $file"); //e盘为antiword软件所在的盘echo $content;?>

转载请注明出处http://blog.csdn.net/iluckyning/article/details/22783625

0 0
原创粉丝点击