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 函数 returns whether more rows are availablephp stream 函数 tells whether the stream supports lockingphp 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 returns whether the given filename is a valid phar filenamephp phar returns true if the phar archive can be modifiedphp 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 solrquery returns whether or not to enable highlighting for range/wildcard/fuzzy/prefix queriesphp solrquery returns whether or not to include the lower bound in the result set
关注编程学问公众号