Images.php
811 Bytes
<?php
use Action\WebAction;
use Plugin\Captcha;
class ImagesController extends WebAction
{
/**
* 验证码-生成
*
* @return mixed 验证码图片
*/
public function indexAction()
{
$g = trim($this->get('g'));
$namespace = !empty($g) ? $g : 'passport_istration';
$imgCode = new Captcha();
$imgCode->setWidth(150)->setHeight(50)->setWordLen(4)->generate($namespace);
exit();
}
/**
* 验证码-检测
*
* @param string auth_code (验证码)
* @return string true|false
*/
public function verifyimgcodeAction ()
{
if (strtolower($this->get('auth_code')) !== strtolower(Captcha::getFromSession('passport_istration')))
{
die('false');
}
die('true');
}
}