thinkPHP,验证码
在thinkphp中使用验证码很容易,只要调用thinkphp现有的方法就可以。当然,php的GD库肯定是要开的(就是在php.ini中要加载gd模块)。首先,在写Action文件,如:IndexAction.class.php.
在对应的模板文件:Tpl\default\index目录下新建文件verifyTest.html,内容如下:
//重载验证码
function freshVerify() {
document.getElementByIdx('verifyImg').src='__URL__/verify/'+Math.random();
}
<img style='cursor:pointer' title='刷新验证码' src='__URL__/verify' id='verifyImg' onClick='freshVerify()'/>
确定
查看完整版本: thinkPHP,验证码
Tags: 验证码