public function verify_c()
  {
    $Verify = new \Think\Verify();
    $Verify->fontSize = 18;
    $Verify->length = 4;
    $Verify->useNoise = false;
    $Verify->codeSet = '0123456789';
    $Verify->imageW = 130;
    $Verify->imageH = 50;
    //$Verify->expire = 600;
    $Verify->entry();
  }  public function pv()
  {
    if (!empty($_POST)) {
      $verify = new \Think\Verify();
      $code = $_POST['code'];
      if (!empty($code)) {
        echo($code . "\n");
//      dump($code);
        if (!empty($verify)) {
          echo($verify);
          var_dump($verify);
        } else {
          echo("验证码为空");
        }
      } else {
        echo("未输入验证码");
      }
    }
  }    <form action="{:U('Verify/pv',array())}" method="post" id="captcha-container">
      <input name="code" width="50%" height="50" class="captcha-text" 
      placeholder="验证码" type="text" >
      <img width="130" class="left15" height="35" alt="验证码" 
      src="{:U('Home/Verify/verify_c',array())}" title="点击刷新">
      <input type="submit" value="提交"/>
    </form>6436
object(Think\Verify)[6]
  protected 'config' => 
    array (size=15)
      'seKey' => string 'ThinkPHP.CN' (length=11)
      'codeSet' => string '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY' (length=52)
      'expire' => int 1800
      'useZh' => boolean false
      'zhSet' => string '们以我到他会作时要动国产的一是工就年阶义... (length=4500)
      'useImgBg' => boolean false
      'fontSize' => int 25
      'useCurve' => boolean true
      'useNoise' => boolean true
      'imageH' => int 0
      'imageW' => int 0
      'length' => int 5
      'fontttf' => string '' (length=0)
      'bg' => 
        array (size=3)
          0 => int 243
          1 => int 251
          2 => int 254
      'reset' => boolean true
  private '_image' => null
  private '_color' => null为什么取不到TP生成的验证码呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
不用你取得代码,直接调用工具类中的check就可以验证了
$verify = new ThinkVerify();
return $verify->check($code);
自动完成中这样使用就更好了:

ob_clean();//在初始化Verify前加上这个试试
$verify = new ThinkVerify();
我自己解决了可以用以下来直接验证