thinkphp3.2 中的验证码

浏览:704 发布日期:2015/03/07 分类:求助交流
注册登录验证码。在ie中只能刷新一次,在360和搜狗正常。哪位大神帮助一下,不胜感激。
代码如下
UserController.class.php中

public function verify_c(){
$Verify = new \Think\Verify();
$Verify->fontSize = 18;
$Verify->length = 4;
$Verify->useNoise = false;
$Verify->codeSet = '0123456789';
$Verify->imageW = 130;
$Verify->imageH = 50;
//$Verify->expire = 600;
ob_clean();
$Verify->entry();
}

view中
login.html代码如下:
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<title>学员登录</title>
<style type="text/css">
#form1
{
width:300px;
height:500px;
margin:20px auto;
border:0px #039 solid;
padding:20px 20px;
}
</style>
</head>
<body>
<div class="container">
<script>
function updateImg(){
var vcode=document.getElementById('vdImg');
vcode.src=
"{:U('user/verify_c',array())}?temp=Math.random()";
}
</script>
<form name="form1" id="form1" method="post" action="{:U('user/checklogin')}">
<h3>    学员登录</h3 ><br/>
<p>账  号:<input type="text" name="username" id="username" maxlength="16" /> </p><br />
<p>密  码:<input type="password" name="password" id="password" maxlength="16" /> </p><br />
<p>
验证 码:<input name="verify" width="100" height="80" placeholder="输入验证码" type="text">
</br>
      <img id="vdImg" width="30%" height="40" alt="刷新验证码" src="{:U('user/verify_c',array())}" title="看不清刷新" onclick="updateImg()">
<a href="javascript:void(0)" onclick="updateImg()">刷新</a>
</p>
<p>        <input type="submit" name="btn1" id="btn1" value="提交" /></p>
</br>
<p>我还不是学员需要<a href="{:U('index/hy')}">注册学员</a></p>
</form>
</div>
</body>
</html>
最佳答案
评论( 相关
后面还有条评论,点击查看>>