Forum Webscript.Ru
		Программирование => PHP => Тема начата: alex007 от 14 Декабря 2002, 02:44:26
		
			
			- 
				Есть скрипт (взят с http://www.zend.com/codex.php?id=696&single=1):
 
 
 $zipfile = new zipfile();
 
 // add the subdirectory ... important!
 $zipfile -> add_dir("dir/");
 
 // add the binary data stored in the string \'filedata\'
 $filedata = "(read your file into $filedata)";
 $zipfile -> add_file($filedata, "dir/file.txt");
 
 // the next three lines force an immediate download of the zip file:
 header("Content-type: application/octet-stream");
 header("Content-disposition: attachment; filename=test.zip");
 echo $zipfile -> file();
 
 
 // OR instead of doing that, you can write out the file to the loca disk like this:
 $filename = "output.zip";
 $fd = fopen ($filename, "wb");
 $out = fwrite ($fd, $zipfile -> file());
 fclose ($fd);
 
 // then offer it to the user to download:
 //здесь я дописал свое дело так как в оригинале это дело было с ошибкой.
 echo "Click here to download the new zip file.";
 ?>
 
 
 По какой то фигне, сервер выдает следуещее сообщение об ошибке в строке 3:
 Fatal error: Cannot instantiate non-existent class: zipfile in dir/backup.php on line 3
 
 Каким макаром можно устранить эту ошибку??
 
 Жду ответов.
 С Уважением,
 Алекс
- 
				Каким макаром можно устранить эту ошибку?? 
 Установить нужныю библиотеку.
- 
				по ссылке береш php-код класса и сохраняеш в файле с каким-нибудь именем (например zip.class.php) а в свой скрипт в начало пишеш строку
 
 require_once("zip.class.php");
 
- 
				Спасибо