Home >Backend Development >PHP Tutorial >php-这代码有问题吗?为什么我调用函数没有反应?

php-这代码有问题吗?为什么我调用函数没有反应?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-02 11:27:581309browse

php

function genVeriCode($type,$length=4,$clear=true){
$nums=range(0,9); // 数字数组
$lower=range('a','z'); // 小写字母数组
$upper=range('A','Z'); // 大写字母数组
$ignore=array('0','o','O','1','l','I','9','q'); // 难辨认的字符数组

<code>$chars=array();if($type==1)    $chars=$nums; // 只需要数字数组elseif($type==2)    $chars=array_merge($nums,$lower); // 数字+小写字母elseif($type==3)    $chars=array_merge($nums,$lower,$upper); // 数字+小写字母+大写字母if($clear)    $chars=array_diff($chars,$ignore); // 排除难辨认字符$keys=array_rand($chars,$length); // 随机取出length个字符,返回它们的key$code="";foreach($keys as $key)    $code.=$chars[$key]; // 通过key可以去$chars中找到具体的值,并在循环中拼接起来return $code;</code>

}
为什么我调用没反应?

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