= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)hash_update_stream — 從打開的流向活躍的哈希運算上下文中填充數(shù)據(jù)說明hash_update_stream(HashContext $context,">
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash_update_stream — 從打開的流向活躍的哈希運算上下文中填充數(shù)據(jù)
$context
, resource $handle
, int $length
= -1): int
context
由 hash_init() 函數(shù)返回的哈希運算上下文。
handle
創(chuàng)建流的函數(shù)返回的打開的文件句柄。
length
要從 handle
向活躍的哈希運算上下文中拷貝
的最大字符數(shù)。
從 handle
向哈希運算上下文中實際填充的字節(jié)數(shù)量。
版本 | 說明 |
---|---|
7.2.0 | 接收參數(shù)從資源類型修改為 HashContext 對象類型。 |
示例 #1 hash_update_stream() 例程
<?php
$fp = tmpfile();
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
rewind($fp);
$ctx = hash_init('md5');
hash_update_stream($ctx, $fp);
echo hash_final($ctx);
?>
以上例程會輸出:
5c6ffbdd40d9556b73a21e63c3e0e904