zoukankan      html  css  js  c++  java
  • 产生类似GUID的唯一ID

    代码
    function puid($seperator='')
    {
        
    //产生类似GUID的唯一ID,名为Php Unique ID或Personal Unique ID,简称PUID
        $mstime = str_replace' ', '@', microtime() );
        
    $address= ''; //$_SERVER['SERVER_NAME'].'('.$_SERVER['SCRIPT_NAME'].')<<'.$_SERVER['REMOTE_ADDR'].'#'.$_SERVER['HTTP_USER_AGENT'];
        
    $rnd = mt_rand(10000,99999).'-'.mt_rand(10000,99999).'-'.mt_rand(10000,99999).'-'.mt_rand(10000,99999).'-'.mt_rand(10000,99999);
        
    $pre_hash = $mstime.$address.$rnd;
        
    $aft_hash = strtoupper(md5($pre_hash));
        
    return $seperator?substr($aft_hash,0,8).$seperator.substr($aft_hash,8,4).$seperator.substr($aft_hash,12,4).$seperator.substr($aft_hash,16,4).$seperator.substr($aft_hash,20):$aft_hash;
    }


  • 相关阅读:
    GUI常用监听事件
    GUI容器之布局管理器
    布局管理器的综合应用
    GUI容器之Panel
    mongodb
    redis持久化
    本地window启动redis
    redis主从模式
    hash 哈希
    set集合
  • 原文地址:https://www.cnblogs.com/heiing/p/1649064.html
Copyright © 2011-2022 走看看