我从webservice (WSDL)接收大对象。它们的位置之一是以base64字符串形式存储的zip的fileContent。我需要从这个压缩中读取文件名和内容。
我写了以下内容:
$ePackageFile = $ePackage->ePackageFile;
$attachment = $this->mapper->mapEPackageFileData((array)$ePackageFile, false);
$limitMBs = 20 * 1024 * 1024;//20MB LIMIT !
$fp = fopen("php://temp/maxmemory:$limitMBs", 'r+');
fwrite($fp, base64_decode($attachment['attachment_fileContent']));
$zip = new ZipArchive;
$handler = $zip->open("php://temp");
if($handler === FALSE)
return array('status'=>false, 'result'=>'failed to get stream');
$i=0;
$out = array();
while (($file = $zip->getNameIndex($i)) && $file !== false) {
$out[] = array('filename' => $zip->getNameIndex($i), 'content' => $zip->getFromIndex($i));
$i++;
}
$zip->close();但是我仍然有"Warning: ZipArchive::getNameIndex():Invalid or unitialized object ...“
我还使用以下命令检查了文件:
$fp = fopen('test.zip','a+');
fwrite($fp, base64_decode($attachment['attachment_fileContent']));
fclose($fp);然后使用KEKA提取它(成功)。
你能帮我用wrapper阅读内容吗?
编辑:我收到错误代码11 (无法打开文件)。
发布于 2015-11-19 16:56:09
https://stackoverflow.com/questions/33798275
复制相似问题