摘要:先使用composer安裝驗證碼類庫,在composer中文網(wǎng)搜索think-captcha,找到第一個并用命令下載到項目目錄composer require topthink/think-captcha在項目目錄config目錄 新建captcha.php文件<?php /** * Created by PhpStorm. * 
先使用composer安裝驗證碼類庫,在composer中文網(wǎng)搜索think-captcha,找到第一個并用命令下載到項目目錄
composer require topthink/think-captcha
在項目目錄config目錄 新建captcha.php文件
<?php /** * Created by PhpStorm. * User: Administrator * Date: 2019/5/15 * Time: 10:59 */ //驗證碼配置文件 return [ 'codeSet'=>'123456789', 'fontSize'=>18, 'useCurve'=>false, 'imageW'=>150, 'imageH'=>30, 'length'=>4, 'reset'=>true ];
在引用驗證碼處添加代碼:{:captcha_src()}
批改老師:天蓬老師批改時間:2019-05-15 13:19:48
老師總結(jié):調(diào)用方法是對的, composer可以對項目中要用到的組件 , 統(tǒng)一進(jìn)行管理