我正在使用codeigniter帮助我从mySQL数据库创建一个表,但是set_template()将为我创建两个thead标记。我不知道为什么会这样。这是我在codeigniter创建表后得到的:
<table id = "guestList" style="border-collapse: collapse; width: 100%;">
<thead>
<thead style="background: #E3EBEE; font-size: 15px;color: #1C75BC;">
<th style="padding: 10px;">Order#</th>
<th style="padding: 10px;">Qty</th>
<th style="padding: 10px;">Customer</th>
<th style="padding: 10px;">Order Date</th>
<th style="padding: 10px;">Ticket Type</th>
<th style="padding: 10px;">Price</th>
<th style="padding: 10px;">Delivery Method</th>
<th style="padding: 10px;">Option</th>
</thead>
</thead>
这是创建表格的代码:
<?php
$tmpl = array (
'table_open' => '<table id = "guestList" style="border-collapse: collapse; width: 100%;">',
'heading_row_start' => '<thead style="background: #E3EBEE; font-size: 15px;color: #1C75BC;">',
'heading_row_end' => '</thead>',
'heading_cell_start' => '<th style="padding: 10px;">',
'heading_cell_end' => '</th>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td style="padding: 10px;">',
'cell_end' => '</td>',
'row_alt_start' => '<tr>',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td style="padding: 10px;">',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
$this->table->set_heading('Order#', 'Qty' , 'Customer', 'Order Date', 'Ticket Type', 'Price', 'Delivery Method');
echo $this->table->generate($record);
?>