用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3096|回复: 1
收起左侧

2.1.2的验证码的问题,困扰很久了

[复制链接]
发表于 2012-8-28 09:27:32 | 显示全部楼层 |阅读模式
试了下自带的验证码的库,发现直接使用控制器的地址可以正常显示,但是在视图中src地址调用控制器地址的时候就显示红叉了,如下错误
Resource interpreted as Image but transferred with MIME type text/html
是说MIME类型不是图片类型,在方法里加header也不行,求教各位!!!
如下是控制器的方法:
PHP复制代码
 
public function auth()
    {
        //header("Content-Type:image/jpeg");
        $this->load->helper('captcha');
 
        $captcha_conf = array(
            'img_path' => './captcha/',
            'img_url' => base_url() . 'captcha/',
            'font_path' => '',
            'img_width' => 100,
            'img_height' => 30,
            'expiration' => 60
        );
        $image = create_captcha($captcha_conf);
 
        echo isset($image['image']) ? $image['image'] : '';
    }
 
复制代码


如下是视图:
HTML复制代码
 
<img src="<?php echo site_url('home/auth'); ?>" alt=""  onclick="this.src=this.src + Math.random()" />
 
复制代码

先谢谢各位了!!

发表于 2012-10-11 15:14:02 | 显示全部楼层
帮顶,同求!!!!!!

本版积分规则