直接上代码
$contents = '';
$zip_path = 'xx/aaa.zip';
$read_path = 'xx/11.txt';
$z = new \ZipArchive();
if ($z->open($zip_path)) {
$fp = $z->getStream($read_path);
if (!$fp) exit("failed\n");
while (!feof($fp)) {
$contents .= fread($fp, 2);
}
fclose($fp);
file_put_contents('t', $contents);
// 如无意外将输出读取到的内容
echo $contents;
}