snufkin / console-table
PHP CLI 的表格生成类。
1.0
2013-04-22 05:13 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-20 18:59:21 UTC
README
- 安装 composer
- 运行
composer require snufkin/ConsoleTable
- 大赚!
使用方法
$table = new \Console\Helper\ConsoleTable(); $table->setHeaders(['Column 1', 'Column 2']); $table->addRow(['data 1', 'data 2']); $table->addRow(['data 3', 'data 4']); $table->addRow(['data 5', 'data 6']); echo $table->getTable();
定制化
默认情况下,所有列都左对齐。要更改对齐方式,请使用构造函数中的第一个参数 0
$table = new \Console\Helper\ConsoleTable(0);