<script src="../../../../../jquery-1.11.2.min.js">
</script>
</head>
<body>
<form action="__SELF__" method="post">
<div>账号:<input type="text" name="Uid" /></div>
<div>密码:<input type="text" name="Pwd" /></div>
<div>验证码:<img src="__CONTROLLER__/YZM" id="yzm" /><input type="text" name="yzm" /></div>
<input type="submit" value="登录" />
</form>
<script type="text/javascript">
$(document).ready(function(e) {
$("#yzm").click(function(){
var str = "fe"+Math.random();//加上这句话可以解决验证码不刷新
$(this).attr("src","__CONTROLLER__/YZM/"+str);
})
});
//什么是关联数组,什么是索引数组
</script>
</body>
</html>
public function YZM()
{
$config =array(
'fontSize' => 30,
'useZh' => false, // 使用中文验证码
'length' => 3, // 验证码位数
'useNoise' => false, // 是否添加杂点
'useZh' => true,
);
$z = new ThinkVerify($config);
$z->entry();
}
public function denglu()
{
if(empty($_POST))
{
$this->display();
}
else
{
$z = new ThinkVerify();
$v = $z->check($_POST["yzm"]);
if($v)
{
echo"验证成功";
}
else
{
echo"验证失败";
}
}
}