Phar::canCompress

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

Phar::canCompressReturns whether phar extension supports compression using either zlib or bzip2

说明

final public static Phar::canCompress ([ int $type = 0 ] ) : bool

This should be used to test whether compression is possible prior to loading a phar archive containing compressed files.

参数

type

Either Phar::GZ or Phar::BZ2 can be used to test whether compression is possible with a specific compression algorithm (zlib or bzip2).

返回值

TRUE if compression/decompression is available, FALSE if not.

范例

Example #1 A Phar::canCompress() example

<?php
if (Phar::canCompress()) {
    echo 
file_get_contents('phar://compressedphar.phar/internal/file.txt');
} else {
    echo 
'no compression available';
}
?>

参见

相关文章
php sqlite 函数 executes a query and returns either an array for one single column or the value of the first rowphp zlib 函数 returns the coding type used for output compressionphp phar returns whether phar extension supports compression using either zlib or bzip2php phar returns whether phar extension supports writing and creating pharsphp phar compresses the entire phar archive using gzip or bzip2 compressionphp 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 returns whether phar has global meta dataphp phar used to determine whether phar write operations are being buffered or are flushing directly to diskphp phar returns whether the given filename is a valid phar filenamephp phardata compresses the entire tar/zip archive using gzip or bzip2 compressionphp 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 whether the entry is compressed using bzip2php pharfileinfo returns whether the entry is compressed using gzphp pharfileinfo compresses the current phar entry within the phar using bzip2 compressionphp pharfileinfo compresses the current phar entry within the phar using gz compressionphp reflectionparameter returns whether this parameter can be passed by valuephp reflectionparameter returns whether the default value of this parameter is a constantphp ziparchive returns the name of an entry using its index
关注编程学问公众号