PHP Extension
PHP Extension
Transition from ZipEntry.NextEntry to ZipEntry.GetNext
Provides instructions for replacing deprecated NextEntry method calls with GetNext.Chilkat PHP Extension Downloads
<?php
include("chilkat.php");
$success = false;
// ------------------------------------------------------------------------
// The NextEntry method is deprecated.
// See below or code showing how to rewrite using EntryAt/GetNext
$zip = new CkZip();
$success = $zip->OpenZip('qa_data/zips/xml_files.zip');
if ($success != true) {
print $zip->lastErrorText() . "\n";
exit;
}
// entry is a CkZipEntry
$entry = $zip->FirstEntry();
if ($zip->get_LastMethodSuccess() == false) {
print 'This zip archive is empty.' . "\n";
exit;
}
$finished = false;
while ($finished == false) {
if ($entry->get_IsDirectory() == false) {
print $entry->fileName() . "\n";
}
else {
print '(directory) ' . $entry->fileName() . "\n";
}
// next is a CkZipEntry
$next = $entry->NextEntry();
if ($entry->get_LastMethodSuccess() == false) {
$finished = true;
}
// entry is a CkZipEntry
$entry = $next;
}
$zip->CloseZip();
print '----' . "\n";
// ------------------------------------------------------------------------
// Do the equivalent using EntryAt/GetNext.
$success = $zip->OpenZip('qa_data/zips/xml_files.zip');
$ze = new CkZipEntry();
$zip->EntryAt(0,$ze);
$entryValid = true;
while ($entryValid == true) {
if ($ze->get_IsDirectory() == false) {
print $ze->fileName() . "\n";
}
else {
print '(directory) ' . $ze->fileName() . "\n";
}
$entryValid = $ze->GetNext();
}
$zip->CloseZip();
?>