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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:39:021509browse

随机数,验证码 无 ?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;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn