定制 daimakuai/yii2-captcha 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

daimakuai/yii2-captcha

Composer 安装命令:

composer require daimakuai/yii2-captcha

包简介

yii2 captcha

README 文档

README

yii2 验证码功能,能够处理文字、数字及外文字符集功能。

yii2 captcha with Ability to recognize Arabic and Persian numbers.

screenshot

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist daimakuai/yii2-captcha "*"

or add

"daimakuai/yii2-captcha": "*"

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()
    {
        $this->layout = $this->setting['layout'];
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
            'captcha' => [
                'class' => 'daimakuai\captcha\CaptchaAction',
                'type' => 'numbers', // 'numbers', 'letters' or 'default' (contains numbers & letters)
                'minLength' => 4,
                'maxLength' => 4,
            ],
        ];
    }

在视图里增加 In view

use daimakuai\captcha\Captcha;
<?=
$form->field($model, 'verifyCode')->widget(Captcha::className())
?>

或增加
or add
<?php echo Captcha::widget(['name'=>'captchaimg','captchaAction'=>'captcha']); ?>

在后台Action获取验证码并验证,添加如下代码
Where background checks are needed add.

<?php

$check = $this->createAction('captcha')->validate($captchCode, false);
if($check){
	//验证码正确
}else{
	//验证码错误
}
?>

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-4-Clause
  • 更新时间: 2018-01-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固