关 键 词:
验证 this 图像 var @accessprivate 字符 @vararray array
修改后如下。
<?php
/**
* 这个类用于生成验证码图像, 同时可以对用户输入的验证码进行验证
*
* @author ♂bingo↗ [coolhpy@163.com]
* @since 2006-6-17
* @modify feifengxlq <feifengxlq@gmail.com> http://www.phpobject.net/blog
* @modify 2006-11-9
* 修改说明
*/
class authcode
{
/**
* 验证码
* char: 字符
* angle: 字符偏移的角度 (-30 <= angle <= 30)
* color: 字符颜色
*
* @var array
* @access private
*/
var $code = array();
/**
* 字体信息
* space: 字符间隔 (px)
* size: 字体大小 (px)
* left: 第一个字符距离图像最左边的象素 (px)
* top: 字符距离图像最上边的象素 (px)
* file: 字体文件的路径
*
* @var array
* @access private
*/
var $font = array();
/**
* 图像信息
* type: 图像类型
* mime: MIME 类型
* width: 图像的宽 (px)
* height: 图像高 (px)
* func: 创建图像的方法
*
* @var array
* @access private
*/
var $image = array();
/**
* 干扰信息
* type: 干扰类型 (false 表示不使用)
* density: 干扰密度
*
* @var array
* @access private
*/
var $molestation = array();
/**
* 背景色 (RGB)
* r: 红色 (0 - 255)
* g: 绿色 (0 - 255)
* b: 蓝色 (0 - 255)
*
* @var array
* @access private
*/
var $bg_color = array();
/**
* 默认前景色 (RGB)
* r: 红色 (0 - 255)
* g: 绿色 (0 - 255)
* b: 蓝色 (0 - 255)
*
* @var array
* @access private
*/
var $fg_color = array();
var $authcode='';
/**
* 构造函数,初始化各变量
*
* @access public
*/
function __construct()
{
$this->setCode();
$this->setMolestation();
$this->setImage();
$this->setFont();
$this->setBgColor();
}
/**
* 获取产生的authcode
*/
function getcode()
{
return $this->authcode;
}
/**
* 绘制图像
*
* @access public
* @param string 文件名, 留空表示输出到浏览器
* @return void
*/
function paint($filename='')
{
// 创建图像
$im = imagecreatetruecolor($this->image['width'],
$this->image['height']);
// 设置图像背景
$bg_color = imagecolorallocate($im, $this->bg_color['r'],
$this->bg_color['g'],
$this->bg_color['b']);
imagefilledrectangle($im, 0, 0, $this->image['width'PHP开发资源论坛讨论。
相关文章
图文推荐
主 站 资 源
论 坛 资 源
·SQLite结合PHP的开发实践
·简介一种PHP设计模式:DPT
·在PHP中使用XML-RPC来构造Web Service简介
·PHP网站注入方法之深度分析
·教你使用Apache的rewrite技术来实现URL重写
·Wordpress 2.5 Tags 标签功能
·详细解析:Apache服务器实现的用户验证
·set_include_path在win和linux下的区别
·自定义SESSION(一)——文件
·PDO函数库使用入门
·简介一种PHP设计模式:DPT
·在PHP中使用XML-RPC来构造Web Service简介
·PHP网站注入方法之深度分析
·教你使用Apache的rewrite技术来实现URL重写
·Wordpress 2.5 Tags 标签功能
·详细解析:Apache服务器实现的用户验证
·set_include_path在win和linux下的区别
·自定义SESSION(一)——文件
·PDO函数库使用入门
热门技术文档
·SQLite结合PHP的开发实践
·简介一种PHP设计模式:DPT
·在PHP中使用XML-RPC来构造Web Service简介
·PHP网站注入方法之深度分析
·教你使用Apache的rewrite技术来实现URL重写
·Wordpress 2.5 Tags 标签功能
·关于Servlet及JSP中遇到的多线程同步问题
·详细解析:Apache服务器实现的用户验证
·set_include_path在win和linux下的区别
·自定义SESSION(一)——文件
·简介一种PHP设计模式:DPT
·在PHP中使用XML-RPC来构造Web Service简介
·PHP网站注入方法之深度分析
·教你使用Apache的rewrite技术来实现URL重写
·Wordpress 2.5 Tags 标签功能
·关于Servlet及JSP中遇到的多线程同步问题
·详细解析:Apache服务器实现的用户验证
·set_include_path在win和linux下的区别
·自定义SESSION(一)——文件
最新图文档
本站编辑推荐:(本站开通Delphi4PHP专区,欢迎进入论坛交流!)
- > 3分钟快速了解 Delphi for PHP 特色 (中文), PDF档
- > 购买Delphi for PHP的五大理由, PDF档
- > Delphi for PHP 使用规格介绍, PDF档
- > Delphi for PHP 問答集 (From CodeGear)
- > Delphi for PHP 产品价格表
编缉最近更新文章
网站赞助商
搜索您感兴趣的内容



