码迷,mamicode.com
首页 > Web开发 > 详细

PHP生成 GUID全球唯一标识符

时间:2017-09-24 18:24:26      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:bst   upper   function   turn   生成   uid   标识   fun   php   

function create_guid() { 
$charid = strtoupper(md5(uniqid(mt_rand(), true))); 
$hyphen = chr(45);// "-" 
$uuid = chr(123)// "{" 
.substr($charid, 0, 8).$hyphen 
.substr($charid, 8, 4).$hyphen 
.substr($charid,12, 4).$hyphen 
.substr($charid,16, 4).$hyphen 
.substr($charid,20,12) 
.chr(125);// "}" 
return $uuid; 
}

PHP生成 GUID全球唯一标识符

标签:bst   upper   function   turn   生成   uid   标识   fun   php   

原文地址:http://www.cnblogs.com/supreme-H/p/7587762.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!