php 验证码的类
类的代码:
1
<?php
2
3
class
Captcha
4
{
5
private
$width
;
6
private
$height
;
7
private
$codeNum
;
8
private
$code
;
9
private
$im
;
10
11
function
__construct(
$width
=80,
$height
=20,
$codeNum
=4)
12
{
13
$this
->width =
$width
;
14
$this
->height =
$height
;
15
$this
->codeNum =
$codeNum
;
16
}
17
18
function
showImg()
19
{
20
//创建图片
21
$this
->createImg();
22
//设置干扰元素
23
$this
->setDisturb();
24
//设置验证码
25
$this
->setCaptcha();
26
//输出图片
27
$this
->outputImg();
28
}
29
//http://www.cnblogs.com/sosoft/