Vitajte na [www.pocitac.win] Pripojiť k domovskej stránke Obľúbené stránky
Otvorte PHP skriptu príkazového riadku . Zadajte nasledujúci kód :
" class createDirZip rozširuje createZip {
funkcie get_files_from_folder ( $ adresár , $ put_into ) {
if ( $ handle = opendir ( $ directory ) ) {
while ( false! == ( $ file = readdir ( $ handle ) ) ) {
if ( is_file ( $ adresár . $ súbor ) ) {
$ fileContents = file_get_contents ( $ adresára $ súbor . ) ;
$ this - > AddFile ( $ fileContents , $ put_into $ file . ) ; ! ' . "
} elseif ( $ file = a $ súbor ! = " .. " a is_dir ( $ adresár . $ súbor ) ) . $ Put_into $ file ' /' ) ; .
}
}
}
Closedir ( $ handle ) ;
. }
} "
2
Napíšte tento kód získať súbory z adresára a podadresára :
" $ createZip = new . " témy /' ) ; "
3
zadajte nasledujúci kód pre vytvorenie objektu z rozšírenia a definovať základný priečinok :
" $ filename = ' tmp /Archive.zip " ;
$ fd = fopen ( $ filename , ' wb ' ) ;
$ out = fwrite ( $ fd , $ createZip - > getZippedfile ( ) ) ;
fclose ( $ fd ) ;
$ createZip - > forceDownload ( $ filename) ;
@ unlink ( $ filename) ; . "
bude výstupné zip súbor .
Copyright © počítačové znalosti Všetky práva vyhradené