yii登陆中添加验证码
1、在SiteController中添加如下代码:
- /**
- * Declares class-based actions.
- */
- public function actions() {
- return array(
- // captcha action renders the CAPTCHA image displayed on the contact page
- 'captcha' => array(
- 'class' => 'CCaptchaAction',
- 'backColor' => 0xFFFFFF,
- ),
- // page action renders "static" pages stored under 'protected/views/site/pages'
- // They can be accessed via: index.php?r=site/page&view=FileName
- 'page' => array(
- 'class' => 'CViewAction',
- ),
- );
- }
2、在 Model/LoginForm.php中
添加一个属性: public $verifyCode;
在rules数组最后添加:array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
3、在视图中,在view/login.php中需要添加验证码的地方写上:
<input id='LoginForm_verifyCode' type="text" name="LoginForm[verifyCode]" >
<?php $this->widget('CCaptcha'); ?>
// 下面这个可以点击图片进行换验证码
<div><?php $this->widget('CCaptcha',array('showRefreshButton'=>false,'clickableImage'=>true,'imageOptions'=>array('alt'=>'点击换图','title'=>'点击换图','style'=>'cursor:pointer'))); ?></div>
yii登陆中添加验证码的更多相关文章
- Yii Model中添加默认搜索条件
在查询中增加条件 public function defaultScope() { return array( 'condition' => " is_deleted = 0" ...
- PHPCMS v9 自定义表单添加验证码验证
1. 在 \phpcms\templates\default\formguide\show.html 中添加验证码显示 <input type="text" id=" ...
- PHPCMS v9 自定义表单添加验证码
1. 在 \phpcms\templates\default\formguide\show.html 中添加验证码显示 <input type="text" id=&quo ...
- [phpcms v9]自定义表单添加验证码验证功能
修改 \phpcms\templates\default\formguide\show.html 中添加验证码显示 <input type="text" id=" ...
- 【转】PHPCMS v9 自定义表单添加验证码验证
1. 在 \phpcms\templates\default\formguide\show.html 中添加验证码显示 <input type="text" id=&quo ...
- .Net 登陆的时候添加验证码
一.ASPX 登陆界面验证码 1.登陆验证码图片和输入验证码框 <asp:TextBox ID="txtValiCode" runat="server" ...
- C# DateTime的11种构造函数 [Abp 源码分析]十五、自动审计记录 .Net 登陆的时候添加验证码 使用Topshelf开发Windows服务、记录日志 日常杂记——C#验证码 c#_生成图片式验证码 C# 利用SharpZipLib生成压缩包 Sql2012如何将远程服务器数据库及表、表结构、表数据导入本地数据库
C# DateTime的11种构造函数 别的也不多说没直接贴代码 using System; using System.Collections.Generic; using System.Glob ...
- Sqlserver 中添加数据库登陆账号并授予数据库所有者权限
Sqlserver 中添加数据库登陆账号并授予数据库所有者权限 USE master GO --通过sp_addlogin创建登录名 --DEMO:登陆账号 --123456:登陆密码 ' --切换数 ...
- yii添加验证码 和重复密码
<?phpnamespace frontend\models; use common\models\User;use yii\base\Model;use Yii; /** * Signup f ...
随机推荐
- Extjs定时操作
查看api可知: // 启动一个简单的时钟任务,每秒执行一次更新一个 div var task = { run: function(){ Ext.fly('clock').update(new Dat ...
- [angular1.6]Error: "transition superseded" ui-router 在angular1.6 报错误问题解决
在angular1.6版本里,使用ui-router如果报这个错误,可以将ui-router升级到最近版本即可.ui-router version v0.4.2
- sscanf 与 sscanf_s
sscanf 与 sscanf_s 之间的Details sscanf sscanf函数想必大家用的很熟练吧 sscanf函数原型: sscanf(const char* src,format,... ...
- [USACO] 奶牛混合起来 Mixed Up Cows
题目描述 Each of Farmer John's N (4 <= N <= 16) cows has a unique serial number S_i (1 <= S_i & ...
- 集合:ListIterator
why ? when ? how ? what ? Java 集合框架图 有了 Iterator 为什么还要有 ListIterator 呢? Iterator 遍历的时候如果你想修改集合中的元素怎么 ...
- Struts2输入错误处理
1.Action类继承ActionSupport父类,将result的name属性设置为<result name="input">/inputError.jsp< ...
- WebSocket客户端学习
1. WebSocket是一种网络通讯协议 参考文档:http://www.ruanyifeng.com/blog/2017/05/websocket.html https://github.com/ ...
- 阿里云服务器Ubuntu 16.04 3安装mysql
.更新系统 apt-get update [注意:要在root用户下] .安装mysql-server apt-get install mysql-serverapt-get install mysq ...
- Netty学习总结(4)——图解Netty之Pipeline、channel、Context之间的数据流向
以下所绘制图形均基于Netty4.0.28版本. 一.connect(outbound类型事件) 当用户调用channel的connect时,会发起一个outbound类型的事件,该事件将在pipel ...
- 次小生成树 判断 unique MST
Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spann ...