提交
This commit is contained in:
23
vendor/topthink/think-captcha/src/CaptchaService.php
vendored
Normal file
23
vendor/topthink/think-captcha/src/CaptchaService.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace think\captcha;
|
||||
|
||||
use think\Route;
|
||||
use think\Service;
|
||||
use think\Validate;
|
||||
|
||||
class CaptchaService extends Service
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
Validate::maker(function ($validate) {
|
||||
$validate->extend('captcha', function ($value) {
|
||||
return captcha_check($value);
|
||||
}, ':attribute错误!');
|
||||
});
|
||||
|
||||
$this->registerRoutes(function (Route $route) {
|
||||
$route->get('captcha/[:config]', "\\think\\captcha\\CaptchaController@index");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user