CodeIgniter img标签 [英] CodeIgniter img tag

查看:148
本文介绍了CodeIgniter img标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码显示带有CodeIgniter框架的图片。

 <?php echo img /logo.png'); > 

这将产生以下输出:

 < img alt =src =http:// localhost:8080 / test / css / sample / logo.png> 

为什么不用 />
此外,当我回显图像时,如何指定 alt 文本?
感谢 .html#imgrel =nofollow>用户指南,则应以/>结尾。



如果你想要一个较短的标签,请使用:

 <?php echo img(array('src'=>'image / picture.jpg','alt'=>'alt information')) > 

有时,如果使用某些浏览器(firefox,chrome)查看源代码,它会省略/>标签。尝试使用记事本或其他东西查看源代码,它应该显示正确的/>标签。


I'm using following code to display an image with CodeIgniter framework.

<?php echo img('sample/logo.png'); ?>

And this is producing following output::

<img alt="" src="http://localhost:8080/test/css/sample/logo.png">

Why it does not closes the tag with /> Also, how can i specify the alt text when i echo image? thanks

解决方案

According to user guide, it should end with />. I tried it out, and it works.

If you want a shorter tag, use this:

<?php echo img(array('src'=>'image/picture.jpg', 'alt'=> 'alt information')); ?>

Sometimes if you view source using certain browsers (firefox, chrome), it omits the /> tag. Try view source using a notepad or something, it should display proper /> tag.

这篇关于CodeIgniter img标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆