PHP ASCII Table Library(PHP ASCII 表库)
问题描述
是否有用于在 PHP 中创建 ASCII表"的事实上的标准库?
Is there a de-facto standard library for creating ASCII "tables" in PHP?
我想要一些 PHP 代码,当处理数组或其他数据结构时,它会输出类似于 mysql 命令行客户端结果的表
I want some PHP code that, when handed an array or other data structure will output tables that look something like the mysql command line client's results
+--------+---------------------+----------------------------------+
| fld_id | fld_name | fld_email |
+--------+---------------------+----------------------------------+
| 1 | A value | another value |
| 2 | A value | |
| 3 | A value | another value |
+--------+---------------------+----------------------------------+
不是火箭科学,甚至不是计算机科学,而是有人已经解决的乏味科学.
Not rocket science, or even computer science, but certainly tedious science that someone's already solved.
推荐答案
虽然它不是事实上的标准,Zend_Text_Table
组件正是这样做的.
While it's not the defacto standard, the Zend_Text_Table
component of the Zend Framework does exactly this.
它具有高度可配置和模块化的额外好处;例如,它使您可以控制各种格式细节.此外,它遵守严格的 OOP 原则(如果这对您很重要).
It has the added bonus of being highly configurable and modular; for example it affords you control over all sorts of formatting details. Also, it adheres to strict OOP principals, if that matters to you.
虽然它是更大库的一部分这一事实可能令人生畏,但该组件是相当解耦的,我能看到的唯一依赖项是 Zend_Loader_PluginLoader
,因为它的可插拔渲染引擎.
While the fact that it is part of a larger library may be intimidating, the component is fairly decoupled, the only dependency I can see is on the Zend_Loader_PluginLoader
, for its pluggable rendering engine.
最重要的是,它完全支持 UTF-8.
Most importantly, it fully supports UTF-8.
这篇关于PHP ASCII 表库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP ASCII 表库


基础教程推荐
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的foreach复选框POST 2021-01-01