thinkphp模板页面输出验证码ThinkPHP教程
<div>
<input type="text" placeholder="请输入验证码" name="ckCode" style="width:90px;height:17px;"/>
<span style="cursor:pointer;" onclick="document.getElementById('cke').src='__APP__/...
<div>
<input type="text" placeholder="请输入验证码" name="ckCode" style="width:90px;height:17px;"/>
<span style="cursor:pointer;" onclick="document.getElementById('cke').src='__APP__/common/verify/random/'+Math.random();">
<img src="__APP__/Common/verify" id="cke"/>看不清</span>
</div>
php后台的验证判断:
<?php
$ckCode=trim($this->_post('ckCode'));//验证码
if($_SESSION['verify'] != md5($ckCode)) {
echo "<script>alert('验证码错误!')</script>";
echo "<script>window.location='wap.php?s=/xiaofeizhe/fadan'</script>";
}
?>
<input type="text" placeholder="请输入验证码" name="ckCode" style="width:90px;height:17px;"/>
<span style="cursor:pointer;" onclick="document.getElementById('cke').src='__APP__/common/verify/random/'+Math.random();">
<img src="__APP__/Common/verify" id="cke"/>看不清</span>
</div>
php后台的验证判断:
<?php
$ckCode=trim($this->_post('ckCode'));//验证码
if($_SESSION['verify'] != md5($ckCode)) {
echo "<script>alert('验证码错误!')</script>";
echo "<script>window.location='wap.php?s=/xiaofeizhe/fadan'</script>";
}
?>
上一篇:Thinkphp 模板变量计算
下一篇:thinkphp删除前弹出确认框
最新评论
热门推荐
我要评论