라이브러리
[PHP] PharFileInfo::decompress - phar 내의 현재 Phar 항목을 압축 해제합니다.
PharFileInfo::decompress
PHP의 PharFileInfo::decompress는 PharArchiveFile의 하위 클래스인 PharFileInfo 객체에서 사용할 수 있는 메서드입니다. 이 메서드는 PharArchiveFile 내의 압축된 파일을 decompress(압축해제)하는 데 사용됩니다.
사용법
PharFileInfo::decompress를 사용하려면 먼저 PharArchiveFile을 열고 PharFileInfo 객체를 생성해야 합니다. PharFileInfo 객체는 PharArchiveFile의 하위 클래스이기 때문에 PharArchiveFile의 메서드를 사용할 수 있습니다.
#hostingforum.kr
php
// PharArchiveFile을 열기
$phar = new Phar('example.phar');
$phar->setStub($phar->createDefaultStub());
// PharFileInfo 객체를 생성
$file = $phar->getFileInfo('example.txt');
예제
다음은 PharFileInfo::decompress를 사용한 예제입니다.
#hostingforum.kr
php
// PharArchiveFile을 열기
$phar = new Phar('example.phar');
$phar->setStub($phar->createDefaultStub());
// PharFileInfo 객체를 생성
$file = $phar->getFileInfo('example.txt');
// 압축된 파일을 decompress
$file->decompress();
// decompress된 파일을 읽기
echo $file->getContent();
옵션
PharFileInfo::decompress는 옵션을 사용할 수 있습니다. 옵션을 사용하려면 두 번째 인자로 옵션을 전달해야 합니다.
#hostingforum.kr
php
$file->decompress($decompressOptions);
다음은 PharFileInfo::decompress에 사용할 수 있는 옵션입니다.
* `PHAR_DECOMPRESS_NONE` : 압축을 decompress하지 않습니다.
* `PHAR_DECOMPRESS_GZ` : gzip 압축을 decompress합니다.
* `PHAR_DECOMPRESS_BZ2` : bzip2 압축을 decompress합니다.
* `PHAR_DECOMPRESS_SHAR` : shar 압축을 decompress합니다.
* `PHAR_DECOMPRESS_ZLIB` : zlib 압축을 decompress합니다.
#hostingforum.kr
php
$file->decompress(PHAR_DECOMPRESS_GZ);
참고
PharFileInfo::decompress는 PharArchiveFile 내의 압축된 파일을 decompress하는 데 사용됩니다. PharArchiveFile은 PHP 5.3.0 이상에서 사용할 수 있습니다. PharFileInfo::decompress는 PHP 5.3.0 이상에서 사용할 수 있습니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.