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 表库
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Laravel 仓库 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01