本文整理匯總了PHP中tar::infosTar方法的典型用法代碼示例。如果您正苦於以下問題:PHP tar::infosTar方法的具體用法?PHP tar::infosTar怎麽用?PHP tar::infosTar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tar
的用法示例。
在下文中一共展示了tar::infosTar方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: infos
function infos($src, $data = false)
{
$ext = '.' . pathinfo($src, PATHINFO_EXTENSION);
foreach ($this->WathArchive as $key => $val) {
if (stripos($ext, $key) !== false) {
$comp = $val;
}
}
if ($comp == 'zip') {
$zip = new zip();
$zipresult = $zip->infosZip($src, $data);
$result['Items'] = count($zipresult);
foreach ($zipresult as $key => $val) {
$result['UnCompSize'] += $zipresult[$key]['UnCompSize'];
}
$result['Size'] = filesize($src);
$result['Ratio'] = $result['UnCompSize'] ? round(100 - $result['Size'] / $result['UnCompSize'] * 100, 1) : false;
} elseif (strlen($comp) > 1) {
$tar = new tar();
if ($comp == 'bz') {
$bzip2 = new bzip2();
$result = $bzip2->infosBzip2($src, true);
$src = $result['Data'];
} elseif ($comp == 'gz') {
$gzip = new gzip();
$result = $gzip->infosGzip($src, true);
$src = $result['Data'];
}
if ($tar->is_tar($src) || is_file($src)) {
$tarresult = $tar->infosTar($src, false);
$result['Items'] = count($tarresult);
$result['UnCompSize'] = 0;
if (empty($result['Size'])) {
$result['Size'] = is_file($src) ? filesize($src) : strlen($src);
}
foreach ($tarresult as $key => $val) {
$result['UnCompSize'] += $tarresult[$key]['size'];
}
$result['Ratio'] = $result['UnCompSize'] ? round(100 - $result['Size'] / $result['UnCompSize'] * 100, 1) : false;
}
if (!$data) {
unset($result['Data']);
}
} else {
return false;
}
return array('Items' => $result['Items'], 'UnCompSize' => $result['UnCompSize'], 'Size' => $result['Size'], 'Ratio' => $result['Ratio']);
}