beecubu / timezone
简单的TimeZone PHP库(基于Scott Connerly的timezone库)。
v0.3
2020-11-05 12:47 UTC
This package is auto-updated.
Last update: 2024-09-05 21:04:34 UTC
README
在PHP中创建时区选择器可能会很快变得杂乱,因为DateTimeZone::listIdentifiers() 返回超过415个区域和链接,允许'priority_zones' 在列表顶部。
示例
echo TimeZoneSelect::get_select(['country'=>'US']);
简单演示:[http://scott.connerly.net/TimeZone/example.php](http://scott.connerly.net/TimeZone/example.php)
可用的参数及其默认值
[
'country' => '', //ISO-3116 2-letter country code
'priority_zones' => [], //If you want to specify a list of zones that aren't country-specific
'priority_label' => 'Regional', //The label of the optgroup for the priority zones
'selected' => '', //which option is selected
'name' => 'time_zone', //name for the <select>
'class' => '', //class for the <select>
'id' => '', //id for the <select>
'data' => [], //list of data attributes to add to the <select>
]
