NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
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使用