php?日历

WBOY
Release: 2016-06-23 13:22:57
Original
1019 people have browsed it


每个事件对应一个开始日期和结束日期
如: 2015-10-05  2015-11-03 XXX 活动
那么当鼠标移动到这段日期时将显示 XXX活动

以下是我的思路,

会不会弄得太麻烦了


回复讨论(解决方案)

你可以在继续研究下

你可以在继续研究下


思路是正确的!
但实现时可以使用些小技巧

$d = '2015-11-01';//查表得到$a = array(  array('event_start_date' => '2015-11-07', 'event_end_date' => '2015-11-15'),  array('event_start_date' => '2015-11-17', 'event_end_date' => '2015-11-20'),);$t = array_fill(1, date('t', strtotime($d)), '');foreach($a as $v) {  $s = date('d', strtotime($v['event_start_date']));  $e = date('d', strtotime($v['event_end_date']));  $t = array_fill( $s, $e - $s + 1, 'event') + $t;}ksort($t);print_r($t);
Copy after login
得到数组
Array(    [1] =>     [2] =>     [3] =>     [4] =>     [5] =>     [6] =>     [7] => event    [8] => event    [9] => event    [10] => event    [11] => event    [12] => event    [13] => event    [14] => event    [15] => event    [16] =>     [17] => event    [18] => event    [19] => event    [20] => event    [21] =>     [22] =>     [23] =>     [24] =>     [25] =>     [26] =>     [27] =>     [28] =>     [29] =>     [30] => )
Copy after login



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template