array date_sun_info ( int $time, float $latitude, float $longitude );
此函数返回一个数组,其中包含有关日落/日出和暮光开始/结束的信息。
time - 时间戳。
latitude - 纬度(以度为单位)。
longitude - 经度
如果成功,则返回数组;如果失败,则返回False。
<?php $sun_info=date_sun_info(strtotime("2017-07-12"), 31.7667, 35.2333); foreach ($sun_info as $key => $val) { echo "$key: " . date("H:i:s", $val) . "\n"; } ?>
这将产生以下输出-
sunrise: 02:42:53 sunset: 16:46:42 transit: 09:44:48 civil_twilight_begin: 02:15:18 civil_twilight_end: 17:14:17 nautical_twilight_begin: 01:41:42 nautical_twilight_end: 17:47:53 astronomical_twilight_begin: 01:05:42 astronomical_twilight_end: 18:23:53
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)