note 118273 added to ziparchive.open
| From: | ohcc at 163 dot com | Date: | Fri, 06 Nov 2015 21:29:23 +0000 |
| Subject: | note 118273 added to ziparchive.open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204099@lists.php.net to get a copy of this message | ||
<?php
// Use ZipArchive::OVERWRITE when the targetd file does not exist may lead you to an error like
this
// Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object
// try ZipArchive::OVERWRITE|ZipArchive::CREATE when you want to replace a zip archive that may not
exist
$zip = new ZipArchive;
$rt=$zip->open('i.zip',ZipArchive::OVERWRITE);
echo $rt;
// when i.zip does not exist, $rt is 9, ZipArchive::ER_NOENT, or "No such file."
$zip->addFile('wuxiancheng.cn.sql','db.sql');
// triggers an error with the message "Warning: ZipArchive::addFile(): Invalid or
uninitialized Zip object ..."
// Use ZipArchive::OVERWRITE|ZipArchive::CREATE
$zip = new ZipArchive;
$zip->open('i.zip',ZipArchive::OVERWRITE|ZipArchive::CREATE);
$zip->addFile('wuxiancheng.cn.sql','db.sql');
?>
----
Server IP: 72.52.91.14
Probable Submitter: 118.117.77.220
----
Manual Page -- http://php.net/manual/en/ziparchive.open.php
Edit -- https://master.php.net/note/edit/118273
Del: integrated -- https://master.php.net/note/delete/118273/integrated
Del: useless -- https://master.php.net/note/delete/118273/useless
Del: bad code -- https://master.php.net/note/delete/118273/bad+code
Del: spam -- https://master.php.net/note/delete/118273/spam
Del: non-english -- https://master.php.net/note/delete/118273/non-english
Del: in docs -- https://master.php.net/note/delete/118273/in+docs
Del: other reasons-- https://master.php.net/note/delete/118273
Reject -- https://master.php.net/note/reject/118273
Search -- https://master.php.net/manage/user-notes.php