php - ZipArchive not installed in xampp? -
i have newest version of xampp , php version 5.6.3, can't use ziparchive. i've downloaded php_zip.dll , placed in ext dir, i've added extension=php_zip.dll after server reset have warming :
"module 'zip' loaded"
i still see error: ziparchive not found ...
using:
$zip = new ziparchive();
returns error:
fatal error: class 'att\controller\ziparchive' not found in ...
ok, given additional information added upon suggestion in comment things become more clear now. looks like have namespacing issue here: php tries locate class att\controller\ziparchive
, not class ziparchive
. case because try use class inside namespaced script. in case php assume class names local general namespace declared @ beginning of script unless noted specific namespace reference.
try makeing class name reference global namespace explicitly. instead of
$zip = new ziparchive();
do this:
$zip = new \ziparchive;
(note slash (\
) before class name. can drop empty brackets trailing it, since empty.)
now php try locate class called "ziparchive" in global namespace (\
) , (hopefully) succeed... general effect of namespacing in php , has nothing specific class trying use.
you may want read bit php , namespaces. take documentation: http://php.net/manual/en/language.namespaces.php
Comments
Post a Comment