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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-02 11:27:58
Original
1308 people have browsed it

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>
Copy after login

}
为什么我调用没反应?

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template