PharFileInfo::getCompressedSize

(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 1.0.0)

PharFileInfo::getCompressedSizeReturns the actual size of the file (with compression) inside the Phar archive

说明

public PharFileInfo::getCompressedSize ( void ) : int

This returns the size of the file within the Phar archive. Uncompressed files will return the same value for getCompressedSize as they will with filesize()

返回值

The size in bytes of the file within the Phar archive on disk.

范例

Example #1 A PharFileInfo::getCompressedSize() example

<?php
try {
    
$p = new Phar('/path/to/my.phar'0'my.phar');
    
$p['myfile.txt'] = 'hi';
    
$file $p['myfile.txt'];
    echo 
$file->getCompressedSize();
} catch (
Exception $e) {
    echo 
'Write operations failed on my.phar: '$e;
}
?>

以上例程会输出:

2

参见

相关文章
php phar returns whether phar extension supports compression using either zlib or bzip2php phar compresses all files in the current phar archive using bzip2 compressionphp phar compresses all files in the current phar archive using gzip compressionphp phar convert a phar archive to a non executable tar or zip filephp phar convert a phar archive to another executable phar archive file formatphp phar copy a file internal to the phar archive to another new file within the pharphp phar returns the number of entries files in the phar archivephp phar returns phar archive meta dataphp phar returns phar gz or phar bz2 if the entire phar archive is compressed .tar.gz/tar.bz and so on php phar returns true if the phar archive is based on the tar/phar/zip file format depending on the parameterphp phar returns true if the phar archive can be modifiedphp phar gets a pharfileinfo object for a specific filephp phar returns the full path on disk or full phar url to the currently executing phar archivephp phardata copy a file internal to the phar archive to another new file within the pharphp pharfileinfo compresses the current phar entry with either zlib or bzip2 compressionphp pharfileinfo returns the actual size of the file with compression inside the phar archivephp pharfileinfo returns file specific meta data saved with a filephp pharfileinfo returns the phar file entry flagsphp pharfileinfo returns whether file entry has had its crc verifiedphp pharfileinfo compresses the current phar entry within the phar using gz compression
关注编程学问公众号