本文整理匯總了PHP中Zip::get_list方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zip::get_list方法的具體用法?PHP Zip::get_list怎麽用?PHP Zip::get_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zip
的用法示例。
在下文中一共展示了Zip::get_list方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ExactFile
function ExactFile($fileName)
{
global $dir, $key;
echo "<font color=green size=1>ÒÔÏÂΪÎļþµÄ¸´Öƽø¶È£¬±àºÅ´ú±íÎļþ¸´ÖƵĸöÊý(µÚÒ»²½/×ÜÈý²½)£º</font><BR>";
$zip = new Zip();
$zipfile = $dir . "/" . $fileName;
$array = $zip->get_list($zipfile);
$count = count($array);
$f = 0;
$d = 0;
for ($i = 0; $i < $count; $i++) {
if ($array[$i][folder] == 0) {
if ($zip->Extract($zipfile, $key, $i) > 0) {
$f++;
}
} else {
$d++;
}
if ($i % 15 == 0 && $i > 1) {
$br = "<BR>";
} else {
$br = '¡¡¡¡';
}
print "<font color=green size=1>" . $i . $br . "</font>";
}
if ($i == $f + $d) {
echo "<BR><font color=green size=1>{$fileName} ½âѹ³É¹¦<br>({$f} ¸öÎļþ {$d} ¸öĿ¼)</font><BR>";
} elseif ($f == 0) {
echo "<BR><font color=red size=1>{$fileName} ½âѹʧ°Ü</font><BR>";
} else {
echo "<BR><font color=orange size=1>{$fileName} δ½âѹÍêÕû<br>(Òѽâѹ {$f} ¸öÎļþ {$d} ¸öĿ¼)</font><BR>";
}
//echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?action=setting&RemoteHostName=".$_GET['RemoteHostName']."'>\n";
//È·¶¨¸üмǼ######################################################
$goalfile = $fileName . ".txt";
if (is_file($goalfile)) {
unlink($goalfile);
}
$string = "±¾¸üаüÒѾ¸üÐÂ";
@(!($handle = fopen($goalfile, 'w')));
if (!fwrite($handle, $string)) {
exit;
}
fclose($handle);
print "<BR><font color=orange size=1>{$string}</font>";
}
示例2: unpackzip
function unpackzip($filename, $key, $indexes = -1, $cover = 0, &$info)
{
global $user;
if (!file_exists($filename)) {
return false;
}
$all = true;
if ($indexes != -1) {
$indexes = "|||" . $indexes . "|||";
}
if ($info != -1) {
$info = array("cover" => array(), "dir" => 0, "folders" => array(), "file" => 0, "size" => 0, "orig_size" => 0, "error" => array());
}
include_once "class/zip.class.php";
$zip = new Zip();
$all = $l = $zip->get_list($filename);
foreach ($l as $file) {
if ($indexes != -1 && !strpos($indexes, "|" . $file["index"] . "|")) {
continue;
}
$ftype = getext($file["filename"]);
if ($user["limit"]["{$ftype}"] && !$user["only"]) {
continue;
} else {
if (!$user["limit"]["{$ftype}"] && $user["only"]) {
continue;
}
}
$path = $key . "/" . $file["filename"];
if ($file["folder"]) {
if (!is_dir($path)) {
@mkdir($path, 0777);
} else {
if ($info != -1) {
$info["folders"][] = $path;
}
}
if ($info != -1) {
$info["dir"]++;
}
} else {
if (file_exists($path)) {
if ($info != -1) {
$info["cover"][] = array("filename" => $path, "index" => $file["index"]);
}
if (!$cover) {
continue;
}
}
if ($zip->Extract($filename, $key, $file["index"])) {
if ($info != -1) {
$info["orig_size"] += $file["compressed_size"];
$info["size"] += $file["size"];
$info["file"]++;
}
} else {
if ($info != -1) {
$info["error"][] = $path;
}
if ($all) {
$all = false;
}
}
}
}
return $all;
}
示例3: ExactFile
function ExactFile($fileName, $dir)
{
$zip = new Zip();
$zipfile = $dir . "/" . $fileName;
$key = $dir . "/";
$array = $zip->get_list($zipfile);
//print_R($array);
$count = count($array);
$f = 0;
$d = 0;
for ($i = 0; $i < $count; $i++) {
if ($array[$i][folder] == 0) {
if ($zip->Extract($zipfile, $key, $i) > 0) {
$f++;
}
print $zipfile;
} else {
$d++;
}
if ($i % 15 == 0 && $i > 1) {
$br = $stored_filename . "<BR>";
} else {
$br = $stored_filename;
}
//print "<font color=green size=1>".$i.$br."</font>";
}
if ($i == $f + $d) {
//echo "<BR><font color=green size=1>$fileName ½âѹ³É¹¦<br>($f ¸öÎļþ $d ¸öĿ¼)</font><BR>";
} elseif ($f == 0) {
//echo "<BR><font color=red size=1>$fileName ½âѹʧ°Ü</font><BR>";
}
//else echo "<BR><font color=orange size=1>$fileName δ½âѹÍêÕû<br>(Òѽâѹ $f ¸öÎļþ $d ¸öĿ¼)</font><BR>";
//echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?action=setting&RemoteHostName=".$_GET['RemoteHostName']."'>\n";
//È·¶¨¸üмǼ######################################################
/*
$goalfile = $dir."/".$fileName.".txt";
if(is_file($goalfile)) {
unlink($goalfile);
}
$string ="±¾¸üаüÒѾ¸üÐÂ";
@!$handle = fopen($goalfile, 'w');
if (!fwrite($handle, $string)) {
exit;
}
fclose($handle);
print "<BR><font color=orange size=1>$string</font>";
*/
}
示例4: fclose
}
fclose($filehandle);
echo "數據庫已成功備份到 <a href=\"" . $path . "\" target=\"_blank\">" . $path . "</a>";
mysql_close();
} else {
echo "備份失敗,請確認目標文件夾是否具有可寫權限!";
}
}
}
} elseif ($downrar) {
if (!empty($dl)) {
if (eregi("unzipto:", $localfile)) {
$path = "" . $dir . "/" . str_replace("unzipto:", "", $localfile) . "";
$zip = new Zip();
$zipfile = $dir . "/" . $dl[0];
$array = $zip->get_list($zipfile);
$count = count($array);
$f = 0;
$d = 0;
for ($i = 0; $i < $count; $i++) {
if ($array[$i][folder] == 0) {
if ($zip->Extract($zipfile, $path, $i) > 0) {
$f++;
}
} else {
$d++;
}
}
if ($i == $f + $d) {
echo "{$dl['0']} 解壓到" . $path . "成功<br>({$f} 個文件 {$d} 個目錄)";
} elseif ($f == 0) {