我的瀏覽頁面代碼如下,但是當我在瀏覽器中檢查它時,它在<ul>
標籤之外有額外的<a>
標籤。我想知道額外的標籤來自哪裏?額外的html標籤 - CodeIgniter
<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>
這裏有雲控制器:
function shirts()
{
$this->load->library('pagination');
$config['base_url'] = 'http://www.example.com/2015.8.5/index.php/home/shirts';///--to use base_url
$config['total_rows'] = $this->db->get('products')->num_rows();
$config['per_page'] = 8;
$config['full_tag_open'] = '<div class="pagination">';
$config['full_tag_close'] = '</div>';
$config['num_links'] = 20;
$this->pagination->initialize($config);
$data['page_title'] = "Mike's shirts";
$data['section'] = "shirts";
$data['products'] = $this->db->get('products', $config['per_page'], $this->uri->segment(3));
$this->load->view('templates/header', $data);
$this->load->view('shirts', $data);
$this->load->view('templates/footer', $data);
}
什麼是你'controller'和'model'? – Hassaan
您還沒有關閉您的img標籤> alt =「」 – Svetoslav