0
와 즉석에서 우편 번호를 생성 즉시 암호를 사용하여 Zip 파일을 만들려고PHP 암호
<?php
$fileRequest = 'cooking-book';
// Prepare File
$file = tempnam("tmp", "zip");
$zip = new ZipArchive();
$zip->open($file, ZipArchive::OVERWRITE);
// Stuff with content
$getFile = file_get_contents('http://otherserver.com/getfile.php?sq='.$fileRequest);
$zip->addFromString('cooking-book.txt', $getFile);
// Close and send to users
$zip->close();
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$fileRequest.'.zip"');
readfile($file);
unlink($file);
?>
지금은 잘 작동 (메모리에 다른 서버에서 다운로드 할 파일을 압축하고, 사용자에게 보내기)입니다 .
우편 번호에 비밀번호를 설정하는 방법은 무엇입니까? (exec() shell_exec()는 사용할 수 없다) 코드에서 어디에 있어야 하는가?
감사합니다.
전에 추가 거라고, 나는 내 호스팅에 그것을 upgrde 수 없습니다
이처럼 사용할 수 있습니다. 다른 방법들? –
setPassword는 압축 해제 전용이므로 현재 PHP 버전에서는 여전히 작동하지 않습니다! 설명서의 참고 사항을 참조하십시오. 이 기능은 아카이브의 압축을 푸는 데 사용할 암호 만 설정합니다. 그것은 암호로 보호되지 않은 ZipArchive를 암호로 보호 된 ZipArchive로 바꾸지 않습니다. - http://docs.php.net/manual/en/ziparchive.setpassword.php – matt