TaoLer/vendor/topthink/think-captcha/src/CaptchaService.php

22 lines
473 B
PHP
Raw Normal View History

2020-01-01 13:17:19 +08:00
<?php
namespace think\captcha;
use think\Route;
use think\Service;
use think\Validate;
class CaptchaService extends Service
{
public function boot(Route $route)
{
$route->get('captcha/[:config]', "\\think\\captcha\\CaptchaController@index");
Validate::maker(function ($validate) {
$validate->extend('captcha', function ($value) {
return captcha_check($value);
}, ':attribute错误!');
});
}
}