12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace app\common\library;
- class UUIDs {
-
-
-
- /**
- * 生成一个UUID
- * @return type
- */
- public static function uuid(){
- $str = md5(uniqid(mt_rand(), true));
- $uuid = substr($str,0,8) ;
- $uuid .= substr($str,8,4) ;
- $uuid .= substr($str,12,4) ;
- $uuid .= substr($str,16,4) ;
- $uuid .= substr($str,20,12);
- return $uuid;
- }
-
- /**
- * 生成一个16位UUID
- * @return type
- */
- public static function uuid16(){
- return substr(md5(uniqid(rand(),1)), 8, 16);;
- }
-
-
-
-
- }
|