Back to index

php5  5.3.10
fopen.php
Go to the documentation of this file.
00001 <?php
00002 if (!extension_loaded('zip')) {
00003     dl('zip.so');
00004 }
00005 
00006 
00007 $fp = fopen('zip://' . dirname(__FILE__) . '/test.zip#test', 'r');
00008 if (!$fp) {
00009        exit("cannot open\n");
00010 }
00011 while (!feof($fp)) {
00012        $contents .= fread($fp, 2);
00013        echo "$contents\n";
00014 }
00015 
00016 fclose($fp);
00017 echo "done.\n";
00018 
00019 
00020 $content = '';
00021 $z = new ZipArchive();
00022 $z->open(dirname(__FILE__) . '/test.zip');
00023 $fp = $z->getStream('test');
00024 
00025 var_dump($fp);
00026 if(!$fp) exit("\n");
00027 while (!feof($fp)) {
00028        $contents .= fread($fp, 2);
00029 }
00030 
00031 fclose($fp);
00032 file_put_contents('t',$contents);
00033 echo "done.\n";
00034 
00035