您现在的位置是:首页 > 编程 > 

使用 PHP 制作生成永不重复的密钥码、激活码等案例教程

2025-07-18 00:08:58
以下是使用 PHP 编写的生成永远唯一的密钥码、激活码的自定义方法函数: /** * 生成永远唯一的密钥码 * sha512(返回128位) sha84(返回96位) sha256(返回64位) md5(返回2位) * 还有很多Hash函数...... * @author xiaochaun * @param int $type 返回格式࿱

以下是使用 PHP 编写的生成永远唯一的密钥码、激活码的自定义方法函数:

/**
 * 生成永远唯一的密钥码
 * sha512(返回128位) sha84(返回96位) sha256(返回64位) md5(返回2位)
 * 还有很多Hash函数......
 * @author xiaochaun
 * @param int $type 返回格式:0大小写混合  1全大写  2全小写
 * @param string $func 启用算法:                
 * @return string
 */
function create_secret($type=0, $func=	sha512	)
{
    $uid = md5(uniqid(rand(),true).microtime());
    $hash = hash($func, $uid);
    $arr = str_split($hash);
    foreach($arr as $v){
        if($type==0){
            $newArr[]= empty(rand(0,1)) ? strtoupper($v) : $v;
        }
        if($type==1){
            $newArr[]= strtoupper($v);
        }
        if($type==2){
            $newArr[]= $v;
        }
    }
    return implode(		, $newArr);
}

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/biancheng/1110873.html

相关标签:无
上传时间: 2025-07-16 23:23:32
留言与评论(共有 18 条评论)
本站网友 爱我很简单
17分钟前 发表
true).microtime()); $hash = hash($func
本站网友 王官庄二手房网
0秒前 发表
$v; } if($type==1){ $newArr[]= strtoupper($v); } if($type==2){ $newArr[]= $v; } } return implode(
本站网友 许朝军
22分钟前 发表
$v; } if($type==1){ $newArr[]= strtoupper($v); } if($type==2){ $newArr[]= $v; } } return implode(
本站网友 createfile失败
28分钟前 发表
激活码的自定义方法函数: /** * 生成永远唯一的密钥码 * sha512(返回128位) sha84(返回96位) sha256(返回64位) md5(返回2位) * 还有很多Hash函数...... * @author xiaochaun * @param int $type 返回格式:0大小写混合 1全大写 2全小写 * @param string $func 启用算法: * @return string */ function create_secret($type=0
本站网友 王艳结婚照
4分钟前 发表
$func= sha512 ) { $uid = md5(uniqid(rand()
本站网友 豆捞坊官网
26分钟前 发表
$uid); $arr = str_split($hash); foreach($arr as $v){ if($type==0){ $newArr[]= empty(rand(0
本站网友 婴儿有机奶粉
24分钟前 发表
$newArr); }
本站网友 懒汉的幸福生活
8分钟前 发表
激活码的自定义方法函数: /** * 生成永远唯一的密钥码 * sha512(返回128位) sha84(返回96位) sha256(返回64位) md5(返回2位) * 还有很多Hash函数...... * @author xiaochaun * @param int $type 返回格式:0大小写混合 1全大写 2全小写 * @param string $func 启用算法: * @return string */ function create_secret($type=0
本站网友 望都县人民政府
29分钟前 发表
以下是使用 PHP 编写的生成永远唯一的密钥码
本站网友 大庆旅行社
22分钟前 发表
$v; } if($type==1){ $newArr[]= strtoupper($v); } if($type==2){ $newArr[]= $v; } } return implode(
本站网友 威马逊
19分钟前 发表
$v; } if($type==1){ $newArr[]= strtoupper($v); } if($type==2){ $newArr[]= $v; } } return implode(
本站网友 安全保卫工作
24分钟前 发表
以下是使用 PHP 编写的生成永远唯一的密钥码
本站网友 杭州不孕不育医院
1分钟前 发表
$v; } if($type==1){ $newArr[]= strtoupper($v); } if($type==2){ $newArr[]= $v; } } return implode(
本站网友 演员李晨
15分钟前 发表
1)) ? strtoupper($v)
本站网友 火钳刘明
0秒前 发表
$func= sha512 ) { $uid = md5(uniqid(rand()
本站网友 激光治疗近视
10分钟前 发表
$func= sha512 ) { $uid = md5(uniqid(rand()
本站网友 圆下巴
11分钟前 发表
$newArr); }