imtiazmahbub/array-to-text-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imtiazmahbub/array-to-text-php

Composer 安装命令:

composer require imtiazmahbub/array-to-text-php

包简介

This PHP class can convert an array into ascii text formatted table

README 文档

README

forked from https://gist.github.com/tony-landis/31477

This PHP class can convert an array into ascii text table.

Example Usage:

require_once ('ArrayToTextTable.php');

$data = array(
	array('company'=>'AIG', 'id'=>1, 'balance'=> '-$99,999,999,999.00'),
	array('company'=>'Wachovia', 'id'=>2, 'balance'=> '-$10,000,000.00'),
	array('company'=>'HP', 'id'=>3, 'balance'=> '$555,000.000.00'),
	array('company'=>'IBM', 'id'=>4, 'balance'=> '$12,000.00')
);

$renderer = new ArrayToTextTable($data);
$renderer->showHeaders(true);
$renderer->render();

Output of above example

+----------+----+---------------------+
| COMPANY  | ID |       BALANCE       |
+----------+----+---------------------+
| AIG      | 1  | -$99,999,999,999.00 |
| Wachovia | 2  | -$10,000,000.00     |
| HP       | 3  | $555,000.000.00     |
| IBM      | 4  | $12,000.00          |
+----------+----+---------------------+

Useful Methods:

render default: false

You can catch the output of the render with render(true)

$output = $renderer->render(true);

showHeaders default: false

Show the headers using the key values of the array for the titles

$renderer->showHeaders(true);

setMaxWidth default: 30

Set the maximum width (number of characters) per column before truncating

$renderer->setMaxWidth(30);

setMaxHeight default: 2

Set the maximum height (number of lines) per row before truncating

$renderer->setMaxHeight(30);

统计信息

  • 总下载量: 103
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固