PHP generates order number, GUID method
Generate order numberfunction build_order_no() { <br>
return date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);<br>
}
Generate GUIDfunction guid() { <br>
if (function_exists('com_create_guid')) { <br>
return com_create_guid(); <br>
} else { <br>
mt_srand((double)microtime()*10000);<br>
$charid = strtoupper(md5(uniqid(rand(), true))); <br>
$hyphen = chr(45); <br>
$uuid = chr(123) <br>
.substr($charid, 0, 8).$hyphen <br>
.substr($charid, 8, 4).$hyphen <br>
.substr($charid,12, 4).$hyphen <br>
.substr($charid,16, 4).$hyphen <br>
.substr($charid,20,12) <br>
.chr(125);<br>
return $uuid; <br>
}<br>
}
To update technology sharing, please go to PHP engineer subscription account.
Yunqi Conference Beijing Station: It is rare for Alibaba technical experts to appear on the scene. More than 100 people came this time? !