其实验证码我们以前也自己写过,就是用GD库写
现在不需要了,tp5.1 有扩展包!
1, 引入包:
composer require topthink/think-captcha=2.0.*
2, 写个验证码表单界面
还有一个图片点击的时候,验证码自动切换,中间用到JQuery, 说白了,就是修改图片的src属性,如此简单!
<!DOCTYPE html>
<html>
<head>
<title>login</title>
<script type="text/javascript" src ="/static/js/jquery.min.js"></script>
{literal}
<script type="text/javascript">
window.onload = function(){
// console.log($('.my_vcode'));
$('.my_vcode').click(function(){
$img_src = $(this).attr('src')+"?r="+Math.random();
$(this).attr