开发者

How come CodeIgniter's img tag doesn't fill the "src" properly?

My code is as follows:

$image_array = array(
    "src"   =>  base_url() . "img/ajax-bar_loader.gif"
    );
echo img( $image_array );

But when I debug in FireFox, the tag is:

<img original="http://www.mysite.com/img/ajax-bar_loader.gif" style="">

I'm not really sure where tha开发者_运维知识库t "original" tag came from, but it doesn't render my images. Any ideas?


Since you are only passing the src attribute, have you tried:

echo img(base_url() . "img/ajax-bar_loader.gif");


I guess you don't need the base_url() part. This should suffice.

$image_array = array(
    "src"   =>  "img/ajax-bar_loader.gif"
    );
echo img( $image_array );

For more, go here: http://codeigniter.com/user_guide/helpers/html_helper.html#img

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜