View 用的H-UI的管理后台
这个我看了其他人的验证码代码
<div class="loginbox-textbox">
<input class="form-control" placeholder="请输入验证码" name="captcha" type="text"/>
<img id="cap" alt="验证码" title="点击刷新" style="width:220px;cursor: pointer; margin: 20px 0;border:2px solid rgb(220, 222, 224);" onclick="this.src='{:captcha_src()}'" src="{:captcha_src()}"/>
</div>
这是我自己写的,我用的是H-UI的管理模板
<div class="row cl">
<div class="formControls col-xs-8 col-xs-offset-3">
<input class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
<img id="cap" alt="验证码" title="点击刷新" style="width:220px;cursor: pointer; margin: 20px 0;border:2px solid rgb(220, 222, 224);" onclick="this.src='{:captcha_src()}'" src="{:captcha_src()}"/>
</div>
ViewController
//接收数据
$captcha = input("post");
if(!captcha_check($captcha['captcha'])){
//输入的验证码错误
}else{
//输入的验证码正确
}