php读取word中的数据

1、安装antiword
 下载地址:http://www.winfield.demon.nl/
 解压:tar -zxvf filename
 安装:make && make install
 安装过程中,自动安装到了/root目录下,只有root才能执行该命令,我们需要修改一下路径。copy到/usr中。
 cp /root/bin/*antiword /usr/local/bin/
 mkdir /usr/share/antiword
 cp -R /root/.antiword/* /usr/share/antiword/
 chmod 777 /usr/local/bin/*antiword
 chmod 755 /usr/share/antiword/*
2、php代码:
 $content = shell_exec('/usr/local/bin/antiword '.$filename);
 如果读取的内容中中文为乱码,再加上编码即可:
 $content = shell_exec('/usr/local/bin/antiword -m UTF-8.txt '.$filename );

猜你喜欢

转载自student-lp.iteye.com/blog/2099824
今日推荐