🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# TP6插件 tp6队列消息 ``` <pre class="calibre14">``` composer require topthink<span class="token">/</span>think<span class="token">-</span>queue <span class="token6">//配置文件位于config/queue.php</span> <span class="token2">[</span> <span class="token4">'default'</span><span class="token">=</span><span class="token">></span><span class="token4">'sync'</span> <span class="token6">//驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动,topthink:Topthink驱动</span> <span class="token2">]</span> ``` ``` 验证码生成 `composer require topthink/think-captcha` ``` <pre class="calibre16">``` <span class="token6">//控制器中</span> public <span class="token5">function</span> <span class="token1">captcha</span><span class="token2">(</span>$id <span class="token">=</span> <span class="token4">''</span><span class="token2">)</span> <span class="token2">{</span> <span class="token5">return</span> <span class="token1">captcha</span><span class="token2">(</span>$id<span class="token2">)</span><span class="token2">;</span> <span class="token2">}</span> <span class="token6">//路由定义</span> \think\facade\Route<span class="token2">:</span><span class="token2">:</span><span class="token1">get</span><span class="token2">(</span><span class="token4">'captcha/[:id]'</span><span class="token2">,</span> <span class="token4">"\\think\\captcha\\CaptchaController@index"</span><span class="token2">)</span><span class="token2">;</span> <span class="token6">//验证</span> $this<span class="token">-</span><span class="token">></span><span class="token1">validate</span><span class="token2">(</span>$data<span class="token2">,</span><span class="token2">[</span> <span class="token4">'captcha|验证码'</span><span class="token">=</span><span class="token">></span><span class="token4">'require|captcha'</span> <span class="token2">]</span><span class="token2">)</span><span class="token2">;</span> <span class="token6">//手动验证</span> <span class="token5">if</span><span class="token2">(</span><span class="token">!</span><span class="token1">captcha_check</span><span class="token2">(</span>$captcha<span class="token2">)</span><span class="token2">)</span><span class="token2">{</span> <span class="token6">//验证失败</span> <span class="token2">}</span><span class="token2">;</span> ``` ```