Home > php教程 > php手册 > PHP generates order number, GUID method

PHP generates order number, GUID method

WBOY
Release: 2016-07-06 13:29:18
Original
1131 people have browsed it

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.
PHP generates order number, GUID method

Yunqi Conference Beijing Station: It is rare for Alibaba technical experts to appear on the scene. More than 100 people came this time? !

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template