本文整理匯總了PHP中Zip::get_file方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zip::get_file方法的具體用法?PHP Zip::get_file怎麽用?PHP Zip::get_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zip
的用法示例。
在下文中一共展示了Zip::get_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mysql_escape_string_userdefine
//print $FILE_CONTENT;
mysql_free_result($TABLE_ARRAY);
//if (!fwrite($handle, $FILE_CONTENT)) {
// break;
//}
fclose($handle);
//壓縮SQL文件為ZIP文件
$key = $PureSQLFile . ".zip";
$zip = new Zip();
$zipfile = $filename;
$filesize = @filesize($zipfile);
$fp = @fopen($zipfile, rb);
$zipfiles[] = array($PureSQLFile, @fread($fp, $filesize));
@fclose($fp);
$zip->Add($zipfiles, 1);
if (@fputs(@fopen("../../databackup/" . $key, "wb"), $zip->get_file())) {
$filename = "../../databackup/" . $key;
}
table_begin("500");
print "<tr class=\"TableControl\"> <td colspan=\"12\" align=center> <a href=\"{$filename}\" title='點擊右鍵,選擇目標另存為'>數據庫已經備份完成,總備份" . count($NewTableArray) . "個數據表,點擊右鍵選擇目標另存為下載數據庫SQL文件</a><BR> <input type=button value=返回 class=BigButton onClick=\"location='?'\" title=返回> </td></tr>";
table_end();
}
exit;
}
function mysql_escape_string_userdefine($TEXT)
{
$TEXT = html_entity_decode($TEXT);
$TEXT = htmlspecialchars_decode($TEXT);
$TEXT = ereg_replace("'", "\\'", $TEXT);
$TEXT = ereg_replace('"', '\\"', $TEXT);
$TEXT = ereg_replace(';', '\\;', $TEXT);
示例2: array
$filename = $zipfilearray[$i];
$filesize = @filesize($dir . "/" . $zipfilearray[$i]);
$fp = @fopen($dir . "/" . $filename, rb);
$zipfiles[] = array($filename, @fread($fp, $filesize));
@fclose($fp);
}
} else {
$filename = $dl[$k];
$filesize = @filesize($zipfile);
$fp = @fopen($zipfile, rb);
$zipfiles[] = array($filename, @fread($fp, $filesize));
@fclose($fp);
}
}
$zip->Add($zipfiles, 1);
$code = $zip->get_file();
$ck = "_QQ44997_" . date("Y-m-d", time()) . "";
if (empty($localfile)) {
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Accept-Length: " . strlen($code));
header("Content-Disposition: attachment;filename=" . $_SERVER['HTTP_HOST'] . "" . $ck . "_Files.zip");
echo $code;
exit;
} else {
$fp = @fopen("" . $dir . "/" . $localfile . "", "w");
echo $msg = @fwrite($fp, $code) ? "壓縮保存" . $dir . "/" . $localfile . "本地成功!!" : "目錄" . $dir . "無可寫權限!";
@fclose($fp);
}
}
} else {