<img src="{:captcha_src()}" alt="captcha" />
'captcha' => [
'fontSize' => 18,
'imageH' => 30,
'imageW' =>100,
'length' => 5,
'reset' => true
]
<img onclick="this.src='{:captcha_src()}?'+Math.random()" src="{:captcha_src()}" alt="captcha" />
namespace app\admin\controller;
use think\Controller;
use app\admin\model\Admin;
class Login extends Controller
{
public function index()
{
if(request()->isPost()){
$admin = new Admin();
$data=input('post.');
if($admin->login($data)==3){
$this->success("信息正确,正在为您跳转",'index/index');
}else if($admin->login($data)==4){
$this->error('验证码错误');
}
else{
$this->error("用户名或密码错误");
}
}
return $this->fetch();
}
}