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;
    }
  • 相关阅读:
    杭电 搜索 1253 胜利大逃亡
    杭电 搜索 1258 Sum It Up
    杭电搜索 2612 Find a way
    杭电 搜索 水题1072 Nightmare
    杭电1175简单搜索 连连看
    杭电 1372 Knight Moves
    杭电 oj Rescue 1242
    杭电 1241 Oil Deposits
    杭电 2100 Children’s Queue
    杭电 1103 Flo's Restaurant
  • 原文地址:https://www.cnblogs.com/lujieting/p/12466320.html
Copyright © 2011-2022 走看看