namespace app\index\controller;//声明命名空间
session_start();
use think\Controller;//引入系统控制器类
class Index extends Controller
{
public function index(){
return view(); 显示视图
return $this->fetch(2); //生成验证码
}
public function check(){ // 验证码处理方法
/* $vcode=$_POST['vcode'];*/
$vcode=input("post.vcode",1);//获取表单里验证码的值
if(captcha_check($vcode)){ // 判断验证码是否正确
$this->success("验证码正确","index/index",3);
}else{
$this->success("验证码错误","index/index",3);
}