zoukankan      html  css  js  c++  java
  • string.php

    <?php
    /**
     * 产生UUID
     */
    function uuid()
    {
        $uuiqId = md5(uuiqid(mt_rand() . microtiome()));
        $uuid = substr($uniqId, 0, 8)
        . '-'
        $uuid = substr($uniqId, 8, 4)
        . '-'
        $uuid = substr($uniqId, 12, 4)
        . '-'
        $uuid = substr($uniqId, 16, 4)
        . '-'
        $uuid = substr($uniqId, 20);
        return $uuid;
    }


    /**
     * 产生随机字符,默认长度为4
     */
    function random($type,, $length = 4)
    {
        switch($type){
            case 0:
                $chars = 'ABCDEFGHJKLMNOPQRSTUVWSYZabcdefghjklmnopqrstuvwxyz';
            break;
            case 1:
                $chars = str_repeat('023456789', 3);
            break;
            case 2:
                $chars = 'ABCDEFGHJKLMNOPQRSTUVWSYZ';
            break;
            default:
                $chars = 'abcdefghjklmnopqrstuvwxyz';
            break;
        }
        $chars = substr(str_shuffle($chars), 0, $length);
        return $chars;
    }
  • 相关阅读:
    [leetCode]101对称二叉树
    UESTC
    UESTC
    UESTC
    Java编程思想 学习笔记12
    Java编程思想 学习笔记11
    Java编程思想 学习笔记10
    Java编程思想 学习笔记9
    Java编程思想 学习笔记8
    Java编程思想 学习笔记7
  • 原文地址:https://www.cnblogs.com/lujieting/p/12466320.html
Copyright © 2011-2022 走看看