zip_entry_filesize() 함수는 PHP에 내장된 함수로, zip 압축 파일을 읽는 데 사용됩니다. 다음 글에서는 PHP zip_entry_filesize() 함수 사용법을 소개하겠습니다.
zip_entry_filesize() 함수는 압축 전 zip 아카이브 항목의 원래 파일 크기를 반환하는 데 사용됩니다. zip 항목 리소스를 읽고 zip_entry_filesize() 함수에 인수로 전송하고 성공하면 값을 바이트 단위로 반환합니다.
사용법:
int zip_entry_filesize( $zip_entry )
매개변수: 이 함수는 필수 단일 매개변수 $zip_entry를 허용합니다. 우편번호 입력 리소스를 지정하는 파라미터입니다.
반환 값: 성공 시 바이트 값을 반환합니다.
오류 및 예외:
zip_entry_filesize()는 압축이 성공하기 전의 파일 크기만 바이트 단위로 반환하고, 그렇지 않으면 PHP 경고를 반환합니다.
zip 아카이브가 유효하지 않은 경우 zip_entry_filesize() 함수는 ER_OPEN 오류를 반환합니다.
zip 아카이브가 비어 있으면 zip_entry_filesize() 함수는 ER_NOZIP 오류를 반환합니다.
다음 예제 프로그램은 PHP의 zip_entry_filesize() 함수를 설명하기 위해 설계되었습니다.
프로그램 1:
zip 아카이브 기사.zip이 있고 zip에 다음 파일이 포함되어 있다고 가정합니다.
content .xlsx
<?php // Opening a zip file $zip_handle = zip_open("C:/xampp/htdocs/article.zip"); // Reading a zip entry archive $zip_entry = zip_read($zip_handle); $file = zip_entry_name($zip_entry); // Reading file size before compression $size = zip_entry_filesize($zip_entry); // Displaying the file ans its size echo("File Name: " . $file . "<br>Size:" . $size . " Bytes"); zip_close($zip_handle); ?>
출력:
File Name: article/content.xlsx Size: 9420 Bytes
프로그램 2:
zip 파일 article.zip이 있고 zip에는 다음 파일과 디렉터리가 포함되어 있다고 가정합니다.
디렉토리: img
geeksfor 괴짜 .png
geeksforgeeks1.png
content.xlsx
gfg.pdf
image.jpeg
<?php // Opening a zip file $zip_handle = zip_open("C:/xampp/htdocs/article.zip"); if(is_resource($zip_handle)) { while($zip_entry = zip_read($zip_handle)) { $file = zip_entry_name($zip_entry); // Checking the file size of a zip // archive entry before compression $size = zip_entry_filesize($zip_entry); echo("File Name: " . $file . "<br>Size: " . $size . " Bytes<br>"); } // closing the zip archive zip_close($zip_handle); } else echo("Zip archive cannot be read."); ?>
출력:
File Name: article/content.xlsx Size: 9420 Bytes File Name: article/gfg.pdf Size: 621936 Bytes File Name: article/image.jpeg Size: 159263 Bytes File Name: article/img/ Size: 0 Bytes File Name: article/img/geeksforgeeks.png Size: 751 Bytes File Name: article/img/geeksforgeeks1.png Size: 337 Bytes

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Dreamweaver Mac版
시각적 웹 개발 도구

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)
