Blog / 阅读

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

by admin on 2014-04-02 12:21:49 in ,



原理是用php调用外部工具实现,用到的工具是antiword 
步骤1:下载解压antiword后,将antiword文件夹放到一个系统盘根目录下
步骤2:增加环境变量,我编写了一个批处理脚本,如下:
[plain] view plaincopyprint?
@echo off  
:: place为antiword所在盘符  
set place="e:"  
:: 设置环境变量HOME  
wmic ENVIRONMENT create name="HOME",username="<system>",VariableValue=%place%  
:: 添加Path  
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;%HOME%"  
pause  


步骤3:编写php脚本
[php] view plaincopyprint?
<?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


写评论

相关文章

上一篇:打破陈规偏见,C/C++资源释放

下一篇:DES加密算法详解- -

评论

写评论

* 必填.

分享

栏目

赞助商


热门文章

Tag 云