2 Commits

Author SHA1 Message Date
yunwuxin
02eb4a2667 修正路由定义 2016-06-12 10:42:11 +08:00
yunwuxin
f7670c78cd 废除NOW_TIME常量 2016-06-03 12:25:17 +08:00
2 changed files with 3 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ class Captcha
return false;
}
// session 过期
if (NOW_TIME - $secode['verify_time'] > $this->expire) {
if (time() - $secode['verify_time'] > $this->expire) {
Session::delete($key);
return false;
}
@@ -182,7 +182,7 @@ class Captcha
$code = $this->authcode(strtoupper(implode('', $code)));
$secode = [];
$secode['verify_code'] = $code; // 把校验码保存到session
$secode['verify_time'] = NOW_TIME; // 验证码创建时间
$secode['verify_time'] = time(); // 验证码创建时间
Session::set($key . $id, $secode);
header('Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate');

View File

@@ -9,7 +9,7 @@
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
\think\Route::get('captcha/[:id]', ["\\think\\captcha\\CaptchaController", 'index']);
\think\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index");
\think\Validate::extend('captcha', function ($value, $id = "") {
return captcha_check($value, $id, (array)\think\Config::get('captcha'));