首页 >php教程 >php手册 >随机数,验证码,生成生成随机数PHP代码

随机数,验证码,生成生成随机数PHP代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-06 19:39:021506浏览

随机数,验证码 无 ?php/** *生成随机数 *@param */function randStr($m = 5) { $new_str = ''; $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwsyz0123456789'; for ($i = 1; $i = $m; ++$i) { $new_str .=$str[mt_rand(0, 61)]; } return $new_

随机数,验证码
<?php
/**
 *生成随机数
 *@param
 */
function randStr($m = 5) {
    $new_str = &#39;&#39;;
    $str = &#39;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwsyz0123456789&#39;;
    for ($i = 1; $i <= $m; ++$i) {
        $new_str .=$str[mt_rand(0, 61)];
    }
    return $new_str;
}
//测试
$str = randStr(6);
echo $str;
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn