websetgo / table-tool
该软件包最新版本(dev-master)没有可用的许可证信息。
一个辅助渲染HTML表的类。
dev-master
2014-08-11 15:48 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-21 21:24:42 UTC
README
#TableTool
###这是什么?TableTool是一个php类,用于辅助创建和渲染HTML表。
###如何使用它?一旦您使用composer安装它,就可以这样使用
//default table with no attributes $table = new Table(); //define the table's class (in this case, a bootstrap table) $table = new Table( array( "class" => "table table-bordered table-rounded" ) ); //add a row to the table $table->addRow(array('Gecko', 'Firefox 1.0', 'Win 98+ / OSX.2+', '1.7', 'A')); //add a header row to the table $table->addRow(array('Engine','Browser','User Agent','version', 'CSS Grade'),null,'head'); //the null parameter above can be used in the same was as the table constructor to pass attributes to the row $table->addRow(array('Engine','Browser','User Agent','version', 'CSS Grade'),array("style" => "background:red;"),'head'); //or on a body row $table->addRow(array('Engine','Browser','User Agent','version', 'CSS Grade'),array("style" => "background:red;")); //output the table to the page echo $table->render();
###为什么输出的HTML都在一行上?render()方法不关心元素之间的空白、缩进或其他任何内容。它会输出有效的HTML,但不会尝试使其看起来更美观。