PharFileInfo::getCRC32

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

PharFileInfo::getCRC32Returns CRC32 code or throws an exception if CRC has not been verified

说明

public PharFileInfo::getCRC32 ( void ) : int

This returns the crc32() checksum of the file within the Phar archive.

返回值

The crc32() checksum of the file within the Phar archive.

错误/异常

Throws BadMethodCallException if the file has not yet had its CRC32 verified. This should be impossible with normal use, as the CRC is verified upon opening the file for reading or writing.

范例

Example #1 A PharFileInfo::getCRC32() example

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

以上例程会输出:

3633523372

相关文章
php ktaglib mpeg audioproperties returns if protection mechanisms of an mpeg file are enabledphp intlchar check if code point has the alphabetic unicode propertyphp mongocommandcursor checks if there are results that have not yet been sent from the databasephp mongocursor checks if there are results that have not yet been sent from the databasephp mongocursorinterface checks if there are results that have not yet been sent from the databasephp phar returns true if the phar archive can be modifiedphp pharfileinfo returns crc32 code or throws an exception if crc has not been verifiedphp pharfileinfo returns whether the entry is compressed using bzip2php pharfileinfo returns whether file entry has had its crc verifiedphp recursiveiterator returns if an iterator can be created for the current entryphp solrclientexception returns internal information where the exception was thrownphp solrillegalargumentexception returns internal information where the exception was thrownphp 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 setphp swffont returns the ascent of the font or 0 if not availablephp swffont returns the descent of the font or 0 if not availablephp swffont returns the leading of the font or 0 if not availablephp swftext returns the ascent of the current font at its current size or 0 if not availablephp swftext returns the descent of the current font at its current size or 0 if not availablephp swftext returns the leading of the current font at its current size or 0 if not available
关注编程学问公众号