额外的HTML标签 - CodeIgniter

时间:2015-08-09 05:58:36

标签: php html codeigniter

我的视图页面代码如下所示,但是当我在浏览器中检查它时,它在 JPanel main_jpn = new JPanel(new BorderLayout()); setLayout(new BorderLayout()); 标记之外有额外的<a>标记。我想知道来自????

的额外标签在哪里
<ul>

输出页面源如下:

<div class="wrapper">
    <h1>Mike&rsquo;s Full Catalog of Shirts</h1>

    <?php //$links = $this->pagination->create_links(); ?>
    <?php //echo $links; ?>

    <ul class="products">
        <?php 
        foreach($products->result() as $product){ 

            echo '<li><a href="333"><img src="'.base_url().$product->img.'" alt="'.$product->name.'"</a></li>';
        }
        ?>
    </ul>

    <?php //echo $links; ?>
</div>

这里是控制器:

    <div class="wrapper">
        <h1>Mike’s Full Catalog of Shirts</h1>
    <ul class="products">
<li><a href="333"><img src="http://www.example.com/2015.8.5/img/shirts/shirt-113.jpg" alt="CSS3 Shirt, Black" <="" a=""></a>
</li><li><a href="333"><img src="http://www.example.com/2015.8.5/img/shirts/shirt-114.jpg" alt="PHP Shirt, Yellow" <="" a=""></a></li>
<li><a href="333"><img src="http://www.example.com/2015.8.5/img/shirts/shirt-115.jpg" alt="PHP Shirt, Purple" <="" a=""></a></li>
<li><a href="333"><img src="http://www.example.com/2015.8.5/img/shirts/shirt-116.jpg" alt="PHP Shirt, Green" <="" a=""></a></li>
<a href="333">      </a>
</ul>
<a href="333">

            </a>
</div>

1 个答案:

答案 0 :(得分:1)

您的<img>代码未关闭。见alt="'.$product->name.'"</a>

改变
echo '<li><a href="333"><img src="'.base_url().$product->img.'" alt="'.$product->name.'"</a></li>';

echo '<li><a href="333"><img src="'.base_url().$product->img.'" alt="'.$product->name.'"></a></li>';