PHP zip_entry_open() 함수
예시
ZIP 파일 아카이브를 열고 읽을 수 있도록 디렉토리 항목을 열고 열린 디렉토리 항목에서 읽습니다.
<?php
$zip = zip_open("test.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "<p>Name: " . zip_entry_name($zip_entry) . "<br>";
// Open directory entry for reading
if (zip_entry_open($zip, $zip_entry)) {
echo "File Contents:<br>";
// Read open directory entry
$contents = zip_entry_read($zip_entry);
echo "$contents<br>";
zip_entry_close($zip_entry);
}
echo "</p>";
}
zip_close($zip);
}
?>
코드 출력은 ZIP 아카이브의 내용에 따라 다릅니다.
Name: ziptest.txt
File Contents:
Hello World! This is a test.
Name: htmlziptest.html
File Contents:
Hello World!
This is a test for the zip functions in PHP.
정의 및 사용
zip_entry_open() 함수는 읽을 수 있도록 ZIP 파일의 디렉토리 항목을 엽니다.
통사론
zip_entry_open(zip, zip_entry, mode)
매개변수 값
Parameter | Description |
---|---|
zip | Required. Specifies the ZIP resource opened with zip_open() |
zip_entry | Required. Specifies the ZIP directory entry to open (opened with zip_read()) |
mode | Optional. Specifies the type of access you require to the ZIP archive. Note: Currently, mode is always "rb", because ZIP support in PHP is read only |
기술적 세부 사항
반환 값: | 성공 시 TRUE입니다. 실패시 FALSE |
---|---|
PHP 버전: | 4.1.0+ |
❮ PHP Zip 참조