PHP ASCII表库 [英] PHP ASCII Table Library

查看:78
本文介绍了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.

推荐答案

虽然不是 defacto 标准,但

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表库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆