ZipArchive 클래스
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
소개
Zip으로 압축된 파일 아카이브.
클래스 개요
class ZipArchive implements Countable { /* Properties */ public readonly int $lastId; public readonly int $status; public readonly int $statusSys; public readonly int $numFiles; public readonly string $filename; public readonly string $comment; /* Methods */ public addEmptyDir(string $dirname, int $flags = 0): bool public addFile( string $filepath, string $entryname = "", int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE ): bool public addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE): bool public addGlob(string $pattern, int $flags = 0, array $options = []): array|false public addPattern(string $pattern, string $path = ".", array $options = []): array|false public clearError(): void public close(): bool public count(): int public deleteIndex(int $index): bool public deleteName(string $name): bool public extractTo(string $pathto, array|string|null $files = null): bool public getArchiveComment(int $flags = 0): string|false public getCommentIndex(int $index, int $flags = 0): string|false public getCommentName(string $name, int $flags = 0): string|false public GetExternalAttributesIndex( int $index, int &$opsys, int &$attr, int $flags = ? ): bool public getExternalAttributesName( string $name, int &$opsys, int &$attr, int $flags = 0 ): bool public getFromIndex(int $index, int $len = 0, int $flags = 0): string|false public getFromName(string $name, int $len = 0, int $flags = 0): string|false public getNameIndex(int $index, int $flags = 0): string|false public getStatusString(): string public getStream(string $name): resource|false public getStreamIndex(int $index, int $flags = 0): resource|false public getStreamName(string $name, int $flags = 0): resource|false public static isCompressionMethodSupported(int $method, bool $enc = true): bool public static isEncryptionMethodSupported(int $method, bool $enc = true): bool public locateName(string $name, int $flags = 0): int|false public open(string $filename, int $flags = 0): bool|int public registerCancelCallback(callable $callback): bool public registerProgressCallback(float $rate, callable $callback): bool public renameIndex(int $index, string $new_name): bool public renameName(string $name, string $new_name): bool public replaceFile( string $filepath, string $index, int $start = 0, int $length = 0, int $flags = 0 ): bool public setArchiveComment(string $comment): bool public setCommentIndex(int $index, string $comment): bool public setCommentName(string $name, string $comment): bool public setCompressionIndex(int $index, int $method, int $compflags = 0): bool public setCompressionName(string $name, int $method, int $compflags = 0): bool public setEncryptionIndex(int $index, int $method, ?string $password = null): bool public setEncryptionName(string $name, int $method, ?string $password = null): bool public setExternalAttributesIndex( int $index, int $opsys, int $attr, int $flags = 0 ): bool public setExternalAttributesName( string $name, int $opsys, int $attr, int $flags = 0 ): bool public setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool public setMtimeName(string $name, int $timestamp, int $flags = 0): bool public setPassword(string $password): bool public statIndex(int $index, int $flags = 0): array|false public statName(string $name, int $flags = 0): array|false public unchangeAll(): bool public unchangeArchive(): bool public unchangeIndex(int $index): bool public unchangeName(string $name): bool }
속성
- lastId
- 마지막으로 추가된 항목(파일 또는 디렉터리)의 인덱스 값입니다. PHP 8.0.0 및 PECL zip 1.18.0부터 사용 가능합니다.
- status
- Zip 아카이브의 상태입니다. PHP 8.0.0 및 PECL zip 1.18.0부터 비공개 아카이브에 사용할 수 있습니다.
- statusSys
- Zip 아카이브의 시스템 상태입니다. PHP 8.0.0 및 PECL zip 1.18.0부터 비공개 아카이브에 사용할 수 있습니다.
- numFiles
- 아카이브의 파일 수
- filename
- 파일 시스템의 파일 이름
- comment
- 아카이브에 대한 의견
목차
- ZipArchive::addEmptyDir — 새 디렉토리 추가
- ZipArchive::addFile — 주어진 경로에서 ZIP 아카이브에 파일을 추가합니다.
- ZipArchive::addFromString — 내용을 사용하여 ZIP 아카이브에 파일 추가
- ZipArchive::addGlob — glob 패턴으로 디렉토리에서 파일 추가
- ZipArchive::addPattern — PCRE 패턴으로 디렉토리에서 파일 추가
- ZipArchive::clearError — 상태 오류 메시지, 시스템 및/또는 zip 메시지 지우기
- ZipArchive::close — 활성 아카이브 닫기(열었거나 새로 생성됨)
- ZipArchive::count — 아카이브의 파일 수를 계산합니다.
- ZipArchive::deleteIndex — 인덱스를 사용하여 아카이브에서 항목 삭제
- ZipArchive::deleteName — 해당 이름을 사용하여 아카이브에서 항목 삭제
- ZipArchive::extractTo — 아카이브 내용 추출
- ZipArchive::getArchiveComment — Zip 아카이브 주석을 반환합니다.
- ZipArchive::getCommentIndex — 항목 색인을 사용하여 항목의 주석을 반환합니다.
- ZipArchive::getCommentName — 항목 이름을 사용하여 항목의 주석을 반환합니다.
- ZipArchive::getExternalAttributesIndex — 인덱스로 정의된 항목의 외부 속성 검색
- ZipArchive::getExternalAttributesName — 이름으로 정의된 항목의 외부 속성 검색
- ZipArchive::getFromIndex — 인덱스를 사용하여 항목 내용을 반환합니다.
- ZipArchive::getFromName — 이름을 사용하여 항목 내용을 반환합니다.
- ZipArchive::getNameIndex — 인덱스를 사용하여 항목의 이름을 반환합니다.
- ZipArchive::getStatusString — 상태 오류 메시지, 시스템 및/또는 zip 메시지를 반환합니다.
- ZipArchive::getStream — 이름으로 정의된 항목에 대한 파일 핸들러 가져오기(읽기 전용)
- ZipArchive::getStreamIndex — 인덱스로 정의된 항목에 대한 파일 핸들러 가져오기(읽기 전용)
- ZipArchive::getStreamName — 이름으로 정의된 항목에 대한 파일 핸들러 가져오기(읽기 전용)
- ZipArchive::isCompressionMethodSupported — 압축 메서드는 libzip에서 지원되는지 확인
- ZipArchive::isEncryptionMethodSupported — 암호화 메서드는 libzip에서 지원되는지 확인
- ZipArchive::locateName — 카이브에 있는 항목의 인덱스를 반환합니다.
- ZipArchive::open — ZIP 파일 아카이브 열기
- ZipArchive::registerCancelCallback — 아카이브 닫기 중 취소를 허용하는 콜백을 등록하십시오.
- ZipArchive::registerProgressCallback — 아카이브를 닫는 동안 업데이트를 제공하기 위해 콜백을 등록하십시오.
- ZipArchive::renameIndex — 인덱스로 정의된 항목의 이름을 바꿉니다.
- ZipArchive::renameName — 이름으로 정의된 항목의 이름을 바꿉니다.
- ZipArchive::replaceFile — ZIP 아카이브의 파일을 주어진 경로로 교체
- ZipArchive::setArchiveComment — ZIP 아카이브의 주석 설정
- ZipArchive::setCommentIndex — 인덱스로 정의된 항목의 주석 설정
- ZipArchive::setCommentName — 이름으로 정의된 항목의 주석 설정
- ZipArchive::setCompressionIndex — 인덱스로 정의된 항목의 압축 메서드 설정
- ZipArchive::setCompressionName — 이름으로 정의된 항목의 압축 메서드 설정
- ZipArchive::setEncryptionIndex — 인덱스로 정의된 항목의 암호화 메서드 설정
- ZipArchive::setEncryptionName — 이름으로 정의된 항목의 암호화 메서드 설정
- ZipArchive::setExternalAttributesIndex — 인덱스로 정의된 항목의 외부 속성 설정
- ZipArchive::setExternalAttributesName — 이름으로 정의된 항목의 외부 속성 설정
- ZipArchive::setMtimeIndex — 인덱스로 정의된 항목의 수정 시간 설정
- ZipArchive::setMtimeName — 이름으로 정의된 항목의 수정 시간 설정
- ZipArchive::setPassword — 활성 아카이브의 비밀번호 설정
- ZipArchive::statIndex — 인덱스로 정의된 항목의 세부 정보 가져오기
- ZipArchive::statName — 이름으로 정의된 항목의 세부 정보 가져오기
- ZipArchive::unchangeAll — 아카이브에서 수행된 모든 변경 사항 실행 취소
- ZipArchive::unchangeArchive — 아카이브에서 수행된 모든 전역 변경 사항 되돌리기
- ZipArchive::unchangeIndex — 주어진 인덱스에서 항목에 대한 모든 변경 사항을 되돌립니다.
- ZipArchive::unchangeName — 어진 이름을 가진 항목에 대한 모든 변경 사항 되돌리기