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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:39:02
Original
1505 people have browsed it

随机数,验证码 无 ?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;
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template