module()); if (in_array($module, ['index', 'admin', 'api', 'store'])) { Validate::extend('captcha', function ($value, $id = "") { $clicaptcha = new \addons\clicaptcha\library\Clicaptcha(); $value = $value ? $value : request()->post("captcha"); if (!$clicaptcha->check($value, true)) { return false; }; return true; }); } } /** * 脚本替换 */ public function viewFilter(&$content) { $module = strtolower(request()->module()); if (($module == 'index' && config('fastadmin.user_register_captcha') == 'text') || ($module == 'admin' && config('fastadmin.login_captcha')) || ($module == 'store' && config('fastadmin.login_captcha'))) { $content = preg_replace_callback('/([\s\S]*?)/i', function ($matches) { return '
'; }, $content); if (preg_match('/([\s\S]*?)/i', $content)) { $content = preg_replace('/]*\s+disabled)(?=[^>]*\stype="submit")(.*?)(>)/', '