8.1 验证码的使用

 1. 下载验证码组件

. composer require topthink/think-captcha
. 组件里面 src目录下 helper.php 中有一个方法 captcha_img()


2. 模板页引入

下面两种方式都可以
<div>{:captcha_img()}</div>
<div><img src="{:captcha_src()}" alt="captcha" /></div>

3. 访问验证码的路径

在模板页右键查看源代码
http://www.minxue100.com/index.php/captcha.html

4. 为什么可以访问到

. 它其实访问了这个文件 走到了这个逻辑

5. 开启session

. 验证码加载完成后 会存入到session中

6. 自定义验证码类型

 

 

 

 

 

 

 

 

防守打法

posted @ 2021-08-01 07:54  棉花糖88  阅读(65)  评论(0)    收藏  举报