
ZipArchive::getExternalAttributesIndex 메서드는 ZIP 아카이브 내의 파일에 대한 외부 속성을 인덱스화하여 반환합니다. 이 인덱스는 파일의 크기, 수정 날짜, 액세스 날짜, 생성 날짜, 파일 속성, 그리고 기타 외부 속성을 나타냅니다.
이 메서드를 사용하여 파일의 크기, 수정 날짜, 액세스 날짜, 생성 날짜, 파일 속성, 그리고 기타 외부 속성을 얻을 수 있습니다. 예를 들어:
#hostingforum.kr
php
$zip = new ZipArchive;
if ($zip->open('example.zip') === TRUE) {
$index = $zip->getExternalAttributesIndex();
for ($i = 0; $i < $zip->numFiles; $i++) {
$file = $zip->getNameIndex($i);
$externalAttributes = $zip->getExternalAttributes($index, $file);
echo "파일 이름: $filen";
echo "크기: " . $zip->getExternalAttributes($index, $file, ZipArchive::EXTERNAL_FILE_SIZE) . "n";
echo "수정 날짜: " . $zip->getExternalAttributes($index, $file, ZipArchive::EXTERNAL_FILE_MTIME) . "n";
echo "액세스 날짜: " . $zip->getExternalAttributes($index, $file, ZipArchive::EXTERNAL_FILE_ATIME) . "n";
echo "생성 날짜: " . $zip->getExternalAttributes($index, $file, ZipArchive::EXTERNAL_FILE_CTIME) . "n";
echo "파일 속성: " . $zip->getExternalAttributes($index, $file, ZipArchive::EXTERNAL_FILE_PERMISSIONS) . "n";
}
$zip->close();
}
위 예제에서는 ZIP 아카이브 내의 파일에 대한 외부 속성을 인덱스화하여 반환하고, 각 파일의 크기, 수정 날짜, 액세스 날짜, 생성 날짜, 파일 속성을 출력합니다.
2025-05-05 16:05