Ejemplo n.º 1
0
 /**
  * 验证码
  *
  * @param int $num          验证码个数
  * @param int $width        验证码宽度
  * @param int $height       验证码高度
  * 
  * @return string
  *
  */
 public function verifyCode($num = 4, $width = 130, $height = 50)
 {
     require $this->app->frameworkPath . 'Library/Captcha/VerifyCode.class.php';
     $VerifyCode = new VerifyCode();
     $VerifyCode->codelen = $num;
     $VerifyCode->width = $width;
     $VerifyCode->height = $height;
     $VerifyCode->doimg();
     $this->app->session->setState('verifycode', $VerifyCode->getCode(), 600);
 }
Ejemplo n.º 2
0
 /**
  * 验证码
  *
  * @param string $key       验证码key
  * @param int $num          验证码个数
  * @param int $width        验证码宽度
  * @param int $height       验证码高度
  * @param int $expire       过期时间
  * 
  * @return string
  *
  */
 public function verifyCode($key = 'verifycode', $num = 4, $width = 130, $height = 40, $expire = 600)
 {
     $VerifyCode = new VerifyCode();
     $VerifyCode->codelen = $num;
     $VerifyCode->width = $width;
     $VerifyCode->height = $height;
     $VerifyCode->doimg($key, $expire);
     //Wave::app()->session->setState($key, $VerifyCode->getCode(), $expire);
 }
Ejemplo n.º 3
0
<?php

/*
 * Created on 2012-6-30
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
require 'include/common.inc.php';
require ROOT . '/classes/mgr/verifycode.cls.php';
$_vc = new VerifyCode();
//实例化一个对象
$_vc->doimg();
$_SESSION[SESSIONNAME]['verifycode'] = $_vc->getCode();
//验证码保存到SESSION中