PHP zip_entry_read() 함수
예시
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_read() 함수는 열린 디렉토리 항목에서 읽습니다.
통사론
zip_entry_read(zip_entry, length)
매개변수 값
Parameter | Description |
---|---|
zip_entry | Required. Specifies the directory entry returned by zip_read() |
length | Optional. Specifies the number of (uncompressed) bytes to return. Default is 1024 |
기술적 세부 사항
반환 값: | 파일 끝에서 읽은 데이터 또는 ""입니다. 실패시 FALSE |
---|---|
PHP 버전: | 4.1.0+ |
❮ PHP Zip 참조