略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: hash_copy

2024-03-29

hash_copy

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

hash_copy拷贝哈希运算上下文

说明

hash_copy(HashContext $context): HashContext

参数

context

hash_init() 函数返回的哈希运算上下文。

返回值

返回哈希运算上下文的一个复本。

更新日志

版本 说明
7.2.0 接受的参数以及返回值从资源类型修改为 HashContext 对象类型。

范例

示例 #1 hash_copy() 例程

<?php
$context 
hash_init("md5");
hash_update($context"data");

/* 拷贝上下文资源以便继续使用 */
$copy_context hash_copy($context);

echo 
hash_final($context), "\n";

hash_update($copy_context"data");
echo 
hash_final($copy_context), "\n";
?>

以上例程会输出:

8d777f385d3dfec8815d20f7496026dc
511ae0b1c13f95e5f08f1a0dd3da3d93
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.hash-copy.php

冷却塔厂家 广告
-- 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3