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 domnode checks if the specified namespaceuri is the default namespace or notphp domxpath evaluates the given xpath expression and returns a typed result if possiblephp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp svn 函数 creates a new empty directory returns true if all is ok false otherwisephp svn 函数 creates a new empty file returns true if all is ok false otherwisephp intlchar check if code point is an alphanumeric characterphp intlchar check if code point has the bidi mirrored 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 phardata returns true if the tar/zip archive can be modifiedphp pharfileinfo returns crc32 code or throws an exception if crc has not been verifiedphp pharfileinfo returns whether file entry has had its crc verifiedphp solrquery returns whether or not stats is enabledphp 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
关注编程学问公众号