PHP Class org\Verify

Datei anzeigen Open project: top-think/thinkphp-extend

Protected Properties

Property Type Description
$config

Public Methods

Method Description
__construct ( array $config = [] ) 架构方法 设置参数
__get ( string $name ) : multitype 使用 $this->name 获取配置
__isset ( string $name ) : boolean 检查配置
__set ( string $name, string $value ) : void 设置验证码配置
check ( string $code, string $id = '' ) : boolean 验证验证码是否正确
entry ( string $id = '' ) : void 输出验证码并把验证码的值保存的session中 验证码保存到session的格式为: array('verify_code' => '验证码值', 'verify_time' => '验证码创建时间');

Private Methods

Method Description
_background ( ) 绘制背景图片 注:如果验证码输出图片比较大,将占用比较多的系统资源
_writeCurve ( ) 画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数)
_writeNoise ( ) 画杂点 往图片上写不同颜色的字母或数字
authcode ( $str ) * 加密验证码

Method Details

__construct() public method

架构方法 设置参数
public __construct ( array $config = [] )
$config array 配置参数

__get() public method

使用 $this->name 获取配置
public __get ( string $name ) : multitype
$name string 配置名称
return multitype 配置值

__isset() public method

检查配置
public __isset ( string $name ) : boolean
$name string 配置名称
return boolean

__set() public method

设置验证码配置
public __set ( string $name, string $value ) : void
$name string 配置名称
$value string 配置值
return void

check() public method

验证验证码是否正确
public check ( string $code, string $id = '' ) : boolean
$code string 用户验证码
$id string 验证码标识
return boolean 用户验证码是否正确

entry() public method

输出验证码并把验证码的值保存的session中 验证码保存到session的格式为: array('verify_code' => '验证码值', 'verify_time' => '验证码创建时间');
public entry ( string $id = '' ) : void
$id string 要生成验证码的标识
return void

Property Details

$config protected_oe property

protected $config