class VerifyCode

验证码扩展类 用于生成验证码

Methods

static void
numVerify(int $length = 4, string $type = 'png', int $width = 150, int $height = 35, string $verifyName = 'verifyCode', string $font = 'tahoma.ttf')

生成图像数字验证码

static void
CnVerify(int $length = 4, string $type = 'png', int $width = 180, int $height = 50, string $font = 'tahoma.ttf', string $verifyName = 'verifyCode')

中文验证码

static void
calocVerify(string $type = 'png', int $width = 170, int $height = 45, string $font = 'tahoma.ttf', string $verifyName = 'verifyCode')

生成数字计算题验证码

static bool
checkCode(string $input, bool $isCn = false, string $verifyName = 'verifyCode')

校验验证码

static void
output(resource $image, string $type = 'png', string $filename = null, int $quality = 100)

输出图片

Details

at line 33
static void numVerify(int $length = 4, string $type = 'png', int $width = 150, int $height = 35, string $verifyName = 'verifyCode', string $font = 'tahoma.ttf')

生成图像数字验证码

Parameters

int $length 位数
string $type 图像格式
int $width 宽度
int $height 高度
string $verifyName Cookie中保存的名称
string $font 字体名

Return Value

void

at line 83
static void CnVerify(int $length = 4, string $type = 'png', int $width = 180, int $height = 50, string $font = 'tahoma.ttf', string $verifyName = 'verifyCode')

中文验证码

Parameters

int $length
string $type
int $width
int $height
string $font
string $verifyName

Return Value

void

at line 126
static void calocVerify(string $type = 'png', int $width = 170, int $height = 45, string $font = 'tahoma.ttf', string $verifyName = 'verifyCode')

生成数字计算题验证码

Parameters

string $type
int $width
int $height
string $font
string $verifyName

Return Value

void

at line 214
static bool checkCode(string $input, bool $isCn = false, string $verifyName = 'verifyCode')

校验验证码

Parameters

string $input 用户输入
bool $isCn 是否为中文验证码
string $verifyName 生成验证码时的字段

Return Value

bool 正确返回true,错误返回false

at line 238
static void output(resource $image, string $type = 'png', string $filename = null, int $quality = 100)

输出图片

Parameters

resource $image 被载入的图片
string $type 输出的类型
string $filename 保存的文件名
int $quality jpeg保存的质量

Return Value

void