hreitsma/yii2-simplemath-captcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hreitsma/yii2-simplemath-captcha

Composer 安装命令:

composer require hreitsma/yii2-simplemath-captcha

包简介

Simple Math Captcha

README 文档

README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist hreitsma/yii2-simplemath-captcha "dev-master"

or add

"hreitsma/yii2-simplemath-captcha": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply modify your controler, add or change methode actions():

public function actions()
{
	return [
            ...
            'captcha' => [
                'class' => 'hr\captcha\CaptchaAction',
                'operators' => ['+','-','*'],
                'maxValue' => 10,
                'fontSize' => 18,
            ],
	];
}

In view

<?php
use yii\captcha\Captcha;
?>

<?=
$form->field($model, 'verifyCode')->widget(Captcha::className(), [
    //'captchaAction' => 'site/captcha', // uncomment and change if your not in the default controller or a module
    'template' => '<div class="row"><div class="col-lg-2">{image}</div><div class="col-lg-10">{input}</div></div>',
])->hint('Hint: click on the equation to refresh')
?>

In config/web.php

'rules' => [
    'site/captcha/<refresh:\d+>' => 'site/captcha',
    'site/captcha/<v:\w+>' => 'site/captcha',
]

screenshot

统计信息

  • 总下载量: 5.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-04-11