首页 > Web开发 > 详细

php 生成唯一编码函数

时间:2020-06-19 17:40:40      阅读:82      评论:0      收藏:0      [点我收藏+]

 

     /**
         * [create_guid 生成guid 全球惟一标识符]
         * @return [type] [description]
         */
         
        public function create_guid(){
           $charid = strtoupper(md5(uniqid(mt_rand(), true)));
           $hyphen = chr(45); // "-"
           $uuid   = substr($charid, 0, 8) . $hyphen
           . substr($charid, 8, 4) . $hyphen
           . substr($charid, 12, 4) . $hyphen
           . substr($charid, 16, 4) . $hyphen
           . substr($charid, 20, 12);
           return $uuid;
       }

  

 

php 生成唯一编码函数

原文:https://www.cnblogs.com/jasonLiu2018/p/13163968.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!