ThinkPHP 5 验证码
<div> <form action="{:url('index/check')}" method="post"> <img src="{:captcha_src()}" alt="captcha" /> <input type="text" name="captcha" id="captcha"> <input type="submit" value="提交"> </form> </div>
<?php namespace app\index\controller; use think\Controller; class Index extends Controller { public function index() { return $this->fetch(); } public function check() { $captcha = input('captcha'); if (captcha_check($captcha)) { $this->success('Success'); } else { $this->error('Error'); } } }
本文来自博客园,作者:liessay,转载请注明原文链接:https://www.cnblogs.com/liessay/p/8508570.html