gpt4 book ai didi

php - 在 codeigniter 中,我们如何使用 CI 的函数将特殊的 id 属性赋予表

转载 作者:行者123 更新时间:2023-12-02 22:43:51 24 4
gpt4 key购买 nike

$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();

更新 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);

引用:https://ellislab.com/codeigniter/user-guide/libraries/table.html

关于php - 在 codeigniter 中,我们如何使用 CI 的函数将特殊的 id 属性赋予表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10335333/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com