【发布时间】:2021-08-20 07:40:22
【问题描述】:
我正在使用 lucidFrame 控制台表来创建使用 json 的输出。我下面的代码是
$table = new ConsoleTable();
$table
->setHeaders($strData->header)
->hideBorder();
foreach ($strData->body as $ins) {
$items = [];
foreach ($ins as $key=>$value) {
array_push($items,$value);
}
$table->addRow($items);
// $i++;
}
$table->addBorderLine();
fwrite($fp, str_replace('</pre>','', str_replace('<pre >','',''. $finalHead . $table->getTable().$finalFooter )));
fclose($fp);
我的结果是
** COMP ** STATEMENT as on 12/08/2021
colhead1 colhead2
----------------------------------
CC Limit 1,000
Availed Limit 10,621
PM Stock Value 75,095
RM Stock Value 67,895
Product Stock Value 46,456
Total Stock Value 1,446
75% of stock value 1,835
Investment 0
----------------------------------
*Report taken by NATH on 20/08/2021 at 12:08:22 in PLACE*
我想在每两行之后重复标题。我怎样才能做到这一点 ?请帮忙 我想要的输出是这样的
** COMP ** STATEMENT as on 12/08/2021
colhead1 colhead2
----------------------------------
CC Limit 1,000
Availed Limit 10,621
** COMP ** STATEMENT as on 12/08/2021
colhead1 colhead2
----------------------------------
PM Stock Value 75,095
RM Stock Value 67,895
** COMP ** STATEMENT as on 12/08/2021
colhead1 colhead2
----------------------------------
Product Stock Value 46,456
Total Stock Value 1,446
** COMP ** STATEMENT as on 12/08/2021
colhead1 colhead2
----------------------------------
75% of stock value 1,835
Investment 0
----------------------------------
*Report taken by NATH on 20/08/2021 at 12:08:22 in PLACE*
提前致谢
【问题讨论】:
标签: php console phplucidframe