द्वारा खाली जिप मैं किसी भी त्रुटि लेकिन डाउनलोड किया ज़िप फ़ाइल के बिना कोड का पालन करके डाउनलोड किया ज़िप फ़ाइल हो रही खाली है या भ्रष्ट और आकार हमेशा होता है के बारे में 200 बाइट्स। यानी मैं उस ज़िप फ़ाइल को नहीं खोल सकता। इसके अलावा ZipArchive :: getStatusString() भी दिखाया जा रहा है "कोई त्रुटि"भ्रष्ट हो रही है या ZipArchive php
कोड है:
public function getzip(){
global $config;
$files=array();
if(isset($_COOKIE['hashes'])){
$hashes=explode(',',$_COOKIE['hashes']);
for ($i=0; $i <count($hashes); $i++) {
array_push($files,$config["domain"]."/download/".$hashes[$i]);
}
}
if(count($files)){
$zipname='basket.zip';
$zip = new ZipArchive;
$zip->open($zipname,ZipArchive::CREATE);
foreach ($files as $key=>$value) {
$zip->addFile($value);
}
$status=$zip->getStatusString();
$zip->close();
if(!$zipname)
{
echo "Nothing in Basket";
}
else
{ header('Content-Description: File Transfer');
header('Content-Type: application/zip');
header('Content-Disposition:attachment; filename='.basename($zipname));
header('Content-Length:'.filesize($zipname));
readfile($zipname);
}
}
यह मुझे झूठा दे रहा है। इसका मतलब है कि $ ज़िप नाम की निर्देशिका नहीं बनाई गई है। लेकिन मुझे ज़िप फ़ाइल डाउनलोड करने के बजाय "बास्केट में कुछ भी नहीं" का संदेश नहीं मिला है। –