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 字符串 函数 计算一个字符串的 crc32 多项式php eio 函数 returns number of not yet handled requestsphp sqlite 函数 opens a persistent handle to an sqlite database and create the database if it does not existphp win32service 函数 define or return the exit code for the current running servicephp wincache 函数 adds a variable in user cache only if variable does not already exist in the cachephp intlchar check if code point is permissible in a java identifierphp intlchar check if code point is permissible as the first character in a java identifierphp 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 mongodb bson javascriptinterface returns the javascriptinterface s codephp 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 if a field will only be highlighted if the query matched in this particular fieldphp 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
关注编程学问公众号