本文整理汇总了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) {