php 自定义验证码函数的有关问题

WBOY
Release: 2016-06-13 12:35:49
Original
1095 people have browsed it

php 自定义验证码函数的问题
请教各位一个问题:
php 自定义验证码函数
function random_text($count, $rm_similar = false)
{
    $chars = array_flip(array_merge(range(0, 9), range('A', 'Z')));
    if ($rm_similar)
    {
        unset($chars[0], $chars[1], $chars[2], $chars[5], $chars[8],
            $chars['B'], $chars['I'], $chars['O'], $chars['Q'],
            $chars['S'], $chars['U'], $chars['V'], $chars['Z']);
    }

    for ($i = 0, $text = ''; $i      {
        $text .= array_rand($chars);
    }
    return $text;
}
?>
这段代码是什么作用了,$chars[5]这些是啥意思:unset($chars[0], $chars[1], $chars[2], $chars[5], $chars[8],
            $chars['B'], $chars['I'], $chars['O'], $chars['Q'],
            $chars['S'], $chars['U'], $chars['V'], $chars['Z']);
这个函数调用的话,怎么调用了,给个例子。

php
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!