hash_update_stream
(PHP 5 >= 5.1.2, PHP 7, PECL hash >= 1.1)
hash_update_stream — 将数据从开放流中抽取到活动哈希上下文中
描述
int hash_update_stream ( resource $context , resource $handle [, int $length = -1 ] )
参数
context
由hash_init()返回的散列上下文。
handle
打开任何流创建函数返回的文件句柄。
length
从handle
哈希上下文中复制的最大字符数。
返回值
从handle
添加到哈希上下文的实际字节数。
例子
示例#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
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com