php读取word中的数据

本文介绍如何安装Antiword软件及其配置过程,以便通过PHP脚本读取DOC文件的内容,并解决了中文显示为乱码的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 );

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值