public function open($apk_file, $xml_file='AndroidManifest.xml'){
$zip = new \ZipArchive;
if ($zip->open($apk_file) === TRUE) {
$xml = $zip->getFromName($xml_file);
$zip->close();
if ($xml){
try {
//var_dump($xml);
return $this->parseString($xml);
}catch (Exception $e){
}
}
}
return false;
}
<?php
function open($zip_file, $txt_file_path){
$zip = new \ZipArchive;
if ($zip->open($zip_file) === TRUE) {
$txt = $zip->getFromName($txt_file_path);
$zip->close();
if ($txt){
try {
var_dump($txt);
}catch (Exception $e){
}
}
}
}
$zip_file='testZip.zip';
$txt_file_path='aaa.txt';open($zip_file, $txt_file_path);
$txt_file_path='bbb.txt';open($zip_file, $txt_file_path);
$txt_file_path='ccc/ccc.txt';open($zip_file, $txt_file_path);
$txt_file_path='ccc/ddd.txt';open($zip_file, $txt_file_path);
/*
string 'aaa' (length=3)
string 'bbb' (length=3)
string 'ccc' (length=3)
string 'ddd
' (length=5)
*/
?>