Home  >  Article  >  Backend Development  >  How to turn off the background program in Apple ios7 PHP online packaging program source code

How to turn off the background program in Apple ios7 PHP online packaging program source code

WBOY
WBOYOriginal
2016-07-29 08:38:281026browse

Realize the packaging function ~ easy and convenient! Although the compression ratio is a little worse than winrar, it doesn't matter. After all, it is only packaged for downloading. It saves you the trouble of going to the server to package the site. If the server is not your own, it will be more troublesome. Ask others to help package the package. Copy the code

The code is as follows:


//php compress the directory into a zip package
//Author: Xiaofeng
$button=$_POST['button'];
if($button=="Start packaging")
{
$ zip = new ZipArchive();
$filename = "./".date("Y-m-d")."_".md5(time())."_jackfeng.zip";
if ($zip->open( $filename, ZIPARCHIVE::CREATE)!==TRUE) { exit("Cannot create <$filename>n");
}
$files = listdir();
foreach($files as $path)
{ -$ Zip-& gt; addfile ($ PATH, Str_replace ("./", "", Str_replace ("\", "/", $ PATH)); . $zip->numFiles . "files n";
$zip->close();
}
Function listdir($start_dir='.') {
$files = array();
if (is_dir ($start_dir)) {
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '.')==0 || strcmp($file, '..')==0) continue;
$filepath = $start_dir. '/' . $file; listdir($filepath));                                                                                                             ;
}
return $files;
}
?> ;



lt;/title>                                         ;meta http-equiv="Content-Type" c/html; charset=gb2312">                                                       >                                                       lt;P>


                                    < It can be a long time. After the packaging is completed, the compressed package will be stored in the directory of the site to be packaged, named with packing time + random string of variable length + jackfeng.zip, please Log in to ftp and download.

                                                                      
The above introduces how to close the background program in Apple ios7 and the source code of PHP online packaging program, including the content of how to close the background program in Apple ios7. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn