码迷,mamicode.com
首页 > Web开发 > 详细

php生成随机字符串

时间:2015-06-04 20:52:54      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

<?php

echo make_random_str();

function make_random_str()
{
    $arr = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0",];

    $max = count($arr)-1;
    $aa = mt_rand(0,$max);
    $bb = mt_rand(0,$max);
    $cc = mt_rand(0,$max);
    $dd = mt_rand(0,$max);
    $ee = mt_rand(0,$max);
    $ff = mt_rand(0,$max);

    return $arr[$aa].$arr[$bb].$arr[$cc].$arr[$dd].$arr[$ee].$arr[$ff];
}

 

php生成随机字符串

标签:

原文地址:http://www.cnblogs.com/shaoyikai/p/4552836.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!