php - PHP while($content = zip_read()) 缺少文件
问题描述
我使用脚本浏览压缩文件的内容,脚本只是错过了其中一些
我们在存储发票(平面文件)的服务器上有多个 ZIP 存档。我使用以下代码搜索它们:
foreach($zip_files as $zip_file){
echo $zip_file . "[" . $counter . "/" . $count . "]\n";
$counter++;
//Opening and reading zip file
$zip_content = zip_open($archive_path . "\\" . $zip_file);
while($file = zip_read($zip_content)){
$filename = zip_entry_name($file);
if(strpos($filename,".rcv")){
$content = zip_entry_read($file,4086);
if(strpos($content, "<MvxEnvelope>")){
if(strpos($content, "<Field>TETINR</Field>")){
$type = "TETINR";
$TINR_position = strpos($content, "<Field>TETINR");
$DIVI_position = strpos($content, "<Field>DIVI");
$TINR = substr($content,($TINR_position + 28), 10);
$DIVI = substr($content,($DIVI_position + 26), 3);
fwrite($map, $zip_file . ";" . $filename . ";" . $DIVI . ";" . $TINR . ";" . $type . "\n");
}
}
}
}
}
我希望脚本遍历所有文件,不要错过其中的一些。提前谢谢了
解决方案
推荐阅读
- ios - 代码签名和分析仪器中的应用程序的问题
- c# - 计算最后 X 条记录的平均值
- android - java.lang.IllegalStateException:指定的消息队列同步屏障令牌尚未发布或已被删除
- ios - 捕获 UIView 并在其他 UIView 中显示
- python - ValueError:检查目标时出错:预期dense_6的形状为(46,),但数组的形状为(1,)
- c - 读取调试对象内存时访问被拒绝
- kubernetes - 我可以从 OVH 云提供商将 OVH 负载均衡器连接到我的 Kubernetes 集群吗
- android - 完全用c开发应用程序
- excel - vba 宏:循环上的备用值显示并限制当前区域的选择
- flutter - 将颤动主题颜色更改为黑色时出错