PHP在cli模式下输出表格

v1.0.0 2023-09-06 05:12 UTC

This package is auto-updated.

Last update: 2024-02-06 06:18:40 UTC


README

php在cli模式下输出表格

####安装

composer require xiaosongshu/table

使用

        use Xiaosongshu\Table\Table;

        /** 表头 */
        $header = ['name', 'email'];
        /** 内容 */
        $row = [
            ['张a.三.....','1231232dsfvsa'],
            ['李////////////////////四','xzfbgadsfvgs23'],
            ['李////////////////////四','x啥地方'],
            ['asdfasdgswee','171qwerqwerqwrom'],
            ['asasd23536435gswee','地地道道'],
            ['dfhdfhdfh45756ry7u','32日3日染发'],
            ['234365,..','地地道道哈哈哈哈'],
        ];
        /** 实例化表格 */
        $table = new Table();
        /** 输出表格 */
        $table->table($header,$row);

输出内容

+--------------------------+------------------+
| name                     | email            |
+--------------------------+------------------+
| 张a.三.....              | 1231232dsfvsa     |
+--------------------------+------------------+
| 李////////////////////四 | xzfbgadsfvgs23    |
+--------------------------+------------------+
| 李////////////////////四  | x啥地方           |
+--------------------------+------------------+
| asdfasdgswee             | 171qwerqwerqwrom |
+--------------------------+------------------+
| asasd23536435gswee       | 地地道道           |
+--------------------------+------------------+
| dfhdfhdfh45756ry7u       | 32日3日染发        |
+--------------------------+------------------+
| 234365,..                | 地地道道哈哈哈哈    |
+--------------------------+------------------+

联系作者

email:2723659854@qq.com