webdivane / table
该软件包已被废弃,不再维护。作者建议使用 pimarinov/table 软件包。
PHP 表格助手。
1.3.0
2019-03-30 08:03 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2022-04-03 08:05:20 UTC
README
- BitBucket URL
- 版本 1.1.2-beta
- 发布时间:2016-06-25
安装
您可以通过 composer 安装此软件包。
composer require webdivane/table
用法
table::create("users", "id", "desc", 50);
table::$cols[] = ["ID", "id", ["width"=>"50px"]];
table::$cols[] = ["Name", "name"];
table::$cols[] = ["Email", "email"];
table::$cols[] = ["test","test",["sort"=>false]];
table::$cols[] = ["Created", "created_at_formatted", ["sort"=>"created_at","width"=>"130px"]];
table::$cols[] = ["Updated", "updated_at_formatted", ["sort"=>"updated_at","width"=>"130px"]];
table::$cols[] = ["...", "lnks", ["class"=>"links","sort"=>false]];
table::execute('SELECT * FROM users');
foreach(table::$data as &$cells){
$cells = get_object_vars($cells); //object -> array
if(table::$export === false){
$cells['id'] = sprintf('<a href="/users/%1$d" title="View">%1$d</a>', $cells['id']);
$cells['email'] = sprintf('<a href="mailto:%1$s" title="Send email">%1$s</a>', $cells['email']);
}
}
table::$attributes["table"]["class"] = "table-striped table-sm table-hover table-bordered";
table::load();
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 以获取更多信息。