Php 在codeigniter中,我们如何使用CI';s函数
像Php 在codeigniter中,我们如何使用CI';s函数,php,codeigniter,html-table,Php,Codeigniter,Html Table,像$this->table->generate()这样的普通表格函数会产生以下结果: <table border="0" cellpadding="4" cellspacing="0"> <tr> <td>one</td><td>two</td><td>three</td> </tr> </table> 一二三 我怎样才能生产出这样的产品 <table border
$this->table->generate()
这样的普通表格函数会产生以下结果:
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td>one</td><td>two</td><td>three</td>
</tr>
</table>
一二三
我怎样才能生产出这样的产品
<table border="0" id="myTable" cellpadding="4" cellspacing="0">
您试过这个吗
$tmpl = array ( 'table_open' =>
'<table border="1" cellpadding="2" cellspacing="1" id="YOUR_ID" class="mytable">' );
$this->table->set_template($tmpl);
echo $this->table->generate();
$tmpl=array('table\u open'=>
'' );
$this->table->set_模板($tmpl);
echo$this->table->generate();
更新1:
$tmpl = array (
'table_open' => '<table border="1" cellpadding="2" cellspacing="1" id="YOUR_ID" class="mytable">',
'heading_row_start' => '<tr>',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
'row_alt_start' => '<tr>',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
$tmpl=array(
“表_打开”=>“”,
'标题行开始'=>'',
“标题行末”=>”,
'标题单元格开始'=>'',
“标题单元格结尾”=>”,
'行开始'=>'',
'行结束'=>'',
'单元格\u开始'=>'',
“单元格结束”=>“”,
'行替换开始'=>'',
'行高度结束'=>'',
'单元格替换开始'=>'',
“单元格替换结束”=>“”,
“表_关闭”=>“
);
$this->table->set_模板($tmpl);
Ref:您可以使用
设置模板()
函数将表格打开值设置为所需的输出
$template = array('table_open' => '<table border="0" id="myTable" cellpadding="4" cellspacing="0">');
$this->table->set_template($template);
$template=array('table_open'=>'');
$this->table->set_模板($template);
不使用预先创建的PHPlibrary@techjunkie.css当前位置谢谢你的帮助,你是一个非常聪明的人。对不起,我只是个傻瓜。但是,如果我可能会问,为什么您要使用库而不是编写自己的解决方案?我正在使用CI,并试图以充分的性能使用它。我也给那些写这些库的人提供了信任。@蓝脑,考虑未来的CI文档,这是非常好的,这个问题在他们的表部分回答:这是有效的,但是我还有一个问题。如果你能回答,我会更高兴。这里是我进一步的问题:您发送模板的方式只包括“table_open”。您的发送模板是否影响其他属性,如“行开始”?