ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
1 创建后台登录控制器 ``` php think make:controller admin/Login php think make:controller admin/Login --plain 展示模板 public function index() { return $this->fetch(); } ``` 2 打开调试模式 根目录下的config/app.php ``` // 应用调试模式 'app_debug' => true, // 应用Trace 'app_trace' => true, ``` 3 后台界面使用模板 hui-admin 4 使用验证码库 ``` composer require topthink/think-captcha=2.0.* public function verify() { $config = [ 'fontttf' => '4.ttf', // 验证码字体大小 'fontSize' => 30, // 验证码位数 'length' => 4, // 关闭验证码杂点 'useNoise' => false, // 关闭验证码混淆线 'useCurve' => false, ]; $verify = new Captcha($config); return $verify->entry(); } ``` 页面上使用 ``` <img src="{:url('Login/verify')}" class="reloadverify"> ``` 5 创建后后台登录验证器 ``` php think make:validate admin/LoginValidate ``` 6 创建模型 ``` php think make:model admin/AdminModel protected $table = 'admin'; protected $autoWriteTimestamp = true; ``` 7 退出功能 8 修改密码 session使用