私が理解できない小さな問題に遭遇しました。
データベースなしでキャプチャヘルパーを使用したいのですが、何も機能していないようです。
コンストラクトで、ランダムな文字列を生成する変数を作成しました
   public function __construct()
   {
      parent::__construct();
      $this->rand = random_string('numeric', 4);
   }
この変数を次のようにキャプチャ値に渡しました。
 $vals = array(
     'word'   => $this->rand,
     'img_path'  => './captcha/',
     'img_url'   => base_url() . 'captcha/',
     'font_path'    => './system/fonts/texb.ttf',
     'img_width'    => '150',
     'img_height' => 30,
     'expiration' => 7200
     );
 $cap = create_captcha($vals);
このようなコールバック関数でそれを検証したかった
   function captcha_check()
   {
      if($this->input->post('code') != $this->rand)
      {
         $this->form_validation->set_message('captcha_check', 'Wrong captcha code, hmm are you the Terminator?');
         return false;
      }
   }
そして、何も機能しません。問題は、キャプチャコードが画像とともに表示されることです。問題は検証です。キャプチャフィールドに正しい数字を入力すると、常にエラーが表示されます。何を入力したかわかりません。誰かを喜ばせることができます私にヒントをください?
html:
  <label for="code">Count please </label>
      <?php echo $rand; ?>
  <input type="text" id="code" name="code" class="span3" />
検証行:
$this->form_validation->set_rules('code', 'Captcha', 'required|callback_captcha_check');