Back to index

php5  5.3.10
get_set_comments.php
Go to the documentation of this file.
00001 <?php
00002 error_reporting(E_ALL|E_STRICT);
00003 
00004 copy('test_with_comment.zip', 't.zip');
00005 $z = new ZipArchive;
00006 $z->open('t.zip');
00007 
00008 print_r($z);
00009 
00010 for ($i=0; $i<$z->numFiles; $i++) {
00011        echo "index: $i\n";
00012        print_r($z->getCommentIndex($i));
00013        echo "\n\n";
00014 }
00015 echo "foobar/ " . $z->getCommentName('foobar/') . "\n";
00016 
00017 echo "Archive comment: " . $z->getArchiveComment() . "\n";
00018 
00019 
00020 $z->setCommentIndex(1, 'new comment idx 1');
00021 $z->setCommentName('foobar/', 'new comment foobar/');
00022 
00023 $z->setArchiveComment( 'new archive comment');
00024 
00025 for ($i=0; $i<$z->numFiles; $i++) {
00026        echo "index: $i\n";
00027        print_r($z->getCommentIndex($i));
00028        echo "\n\n";
00029 }
00030 
00031 echo $z->getCommentName('foobar/') . "\n";
00032 
00033 // Get the original comment
00034 echo $z->getCommentName('foobar/', ZIPARCHIVE::FL_UNCHANGED) . "\n";
00035 
00036 echo "Archive comment: " . $z->getArchiveComment() . "\n";
00037 echo "Archive comment (original): " . $z->getArchiveComment(ZIPARCHIVE::FL_UNCHANGED) . "\n";
00038