2

CI2 のキャプチャ ヘルパーが機能しないようです...誰かが私が間違っていることを指摘できますか?

私はドキュメントのすべての手順に従ったと思いますが、私は何のイベントも取得していません。

私のコントローラー


function index()
{
$this->load->helper('form'); $this->load->helper('captcha'); $this->load->model('captcha');

   $vals = array(
    'word'   => 'Random word',
    'img_path'   => '../images/captcha/',
    'img_url'    => 'http://mysite/images/captcha/',
    'font' => '../../system/fonts/texb.ttf',
    'img_width'  => '150',
    'img_height' => 30,
    'expiration' => 7200,
    "time" => time()
   );

   $data['cap'] = create_captcha($vals);

   $cap = array(
    'captcha_time'  => $vals['time'],
    'ip_address'    => $this->input->ip_address(),
    'word'   => $vals['word']
   );

   $this->captcha_model->insert_captcha($cap);
   //print_r(get_defined_vars());   

   $data['main_content'] = 'admin/landing.php';
   $this->load->view('includes/template', $data);

}

私のモデル

function input_captcha($data)
{
    $query = $this->db->insert_string('captcha', $data);
    $this->db->query($query);
}
私の見解

<section>
    <h3>You must captcha this captcha before proceeding to your demise!</h3>
    <article>
        <?php echo form_open('admin/auth');?>
            <p>Who the F are you?</p>
            <?php echo form_input('email', 'your real email!');?>
            <br>
            <?php    echo 'Submit the word you see below:';?>
            <br>
            <?php    echo $cap['image'];?>
            <br>
            <?php    echo '<input type="text" name="captcha" value="" />';   ?>
<br> <?php echo form_submit('submit', 'Send It!');?>
<?php echo form_close();?> </article> </section>

4

1 に答える 1

1

問題は画像のパスにありました。1つは、ログのしきい値を4に設定しても、問題の兆候が見られなかったことです。私はそれを絶対パスに設定し、すべてが正常に機能しました...


    function index()
    {   
        $this->load->helper('form');
        $this->load->helper('captcha');
        $this->load->model('captcha_model');

        $vals = array(
            'img_path'   => '/var/www/mysite.com/images/captcha/',
            'img_url'    => 'http://mysite.com/images/captcha/',
            'font' => '../../system/fonts/texb.ttf',
            'img_width'  => '150',
            'img_height' => 30,
            'expiration' => 7200,
            "time" => time()
            );

        $data['cap'] = create_captcha($vals);

        $cap = array(
            'captcha_time'  => $data['cap']['time'],
            'ip_address'    => $this->input->ip_address(),
            'word'   => $data['cap']['word']
            );

        $this->captcha_model->add_captcha($cap);

        $data['main_content'] = 'admin/landing.php';
        $this->load->view('includes/template', $data);
    }
于 2011-03-04T21:38:21.467 に答える