我的视图页面代码如下所示,但是当我在浏览器中检查它时,它在 JPanel main_jpn = new JPanel(new BorderLayout());
setLayout(new BorderLayout());
标记之外有额外的<a>
标记。我想知道来自????
<ul>
输出页面源如下:
<div class="wrapper">
<h1>Mike’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>
答案 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>';