使用Codeigniter的验证码无效

使用Codeigniter的验证码无效,codeigniter,captcha,Codeigniter,Captcha,我的codeigniter验证码未显示验证码图像 public function captcha_example(){ $this->load->helper("captcha"); $vals = array( 'word' => 'Random word', 'img_path' => base_url().'img/photos/', 'img_url' =&

我的codeigniter验证码未显示验证码图像

 public  function captcha_example(){
    $this->load->helper("captcha");
    $vals = array(
        'word'          => 'Random word',
        'img_path'      => base_url().'img/photos/',
        'img_url'       => base_url().'img/photos/',
        'font_path'     =>  base_url().'system/fonts/texb.ttf',
        'img_width'     => 150,
        'img_height'    => 30,
        'expiration'    => 7200,

    );

    $cap = create_captcha($vals);
    echo $cap['image'];
    //echo  $vals['img_url'];

    $this->load->view('captcha_view');
}

我不知道这段代码有什么问题…

请在控制器中尝试:

$data['cap'] = create_captcha($vals);
$this->load->view('captcha_view', $data);
然后考虑到:

echo form_input($cap);
更新**

也不要简单地使用基本url

    'img_path'      => 'img/photos/',
    'img_url'       => 'img/photos/',
    'font_path'     =>  'system/fonts/texb.ttf',

控制器:Captcha.php

echo form_input($cap);
类Captcha扩展CI_控制器{

public  function captcha_example(){
    $this->load->helper("captcha");
    $this->load->helper('form');
    $vals = array(
        'word'          => 'Random word',
        'img_path'      => base_url().'img/photos/',
        'img_url'       => base_url().'img/photos/',
        'font_path'     =>  base_url().'system/fonts/texb.ttf',
        'img_width'     => 150,
        'img_height'    => 30,
        'expiration'    => 7200,

    );

    $data['cap'] = create_captcha($vals);
    $this->load->view('captcha_view', $data);
    //echo  $vals['img_url'];


}
}

视图:captcha.php

echo form_input($cap);

谢谢!此脚本在没有基本url的情况下工作。。。对不起,我的英语是我的第一语言是塔吉克语。请包括错误回溯(如果有)和你怀疑是什么问题。也许一张图片也会有帮助。