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;
    }
  • 相关阅读:
    KSTORE日常工作遇到问题总结
    调用bat文件执行java文件
    腾讯课堂十大Excel函数
    《将博客搬至CSDN》
    oracle 累加功能,累加百分比
    验证身份证是否合法
    远程登录修改密码
    二叉树的遍历
    nginx启动、重启、关闭
    状态模式-State-订单状态
  • 原文地址:https://www.cnblogs.com/lujieting/p/12466320.html
Copyright © 2011-2022 走看看