2.1.2的验证码的问题,困扰很久了
试了下自带的验证码的库,发现直接使用控制器的地址可以正常显示,但是在视图中src地址调用控制器地址的时候就显示红叉了,如下错误Resource interpreted as Image but transferred with MIME type text/html
是说MIME类型不是图片类型,在方法里加header也不行,求教各位!!!
如下是控制器的方法:
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'] : '';
}
如下是视图:
<img src="<?php echo site_url('home/auth'); ?>" alt=""onclick="this.src=this.src + Math.random()" />
先谢谢各位了!!
帮顶,同求!!!!!!
页:
[1]