waughj/html-select
Composer 安装命令:
composer require waughj/html-select
包简介
Simple class for easily generating select tags.
README 文档
README
Simple class for easily generating select tags.
1st argument is an array of options, which can either be associative or linear. Associative will use the key as the value attribute & value as the name, linear will use the index as the value attribute & the value as the name. If it’s an array of arrays, then it will check to see if that array has “value” & “name” keys & try to use the values of those. To set an option as selected, add a key “selected” with the value true.
The 2nd argument is an associative list of attributes for the select tag.
Example
use WaughJ\HTMLSelect\HTMLSelect;
echo new HTMLSelect
(
[
[ 'value' => 'one', 'name' => 'One' ],
[ 'value' => 'two', 'name' => 'Two', 'selected' => true ],
[ 'value' => 'three', 'name' => 'Three', ]
],
[ 'class' => 'select', 'id' => 'select-1' ]
);
Will output:
<select class="select" id="select-1">
<option value="one">One</option>
<option value="two" selected="selected">Two</option>
<option value="three">Three</option>
</select>
Changelog
0.1.0
- Initial release
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2019-09-24