首页 > 其他 > 详细

实现当前月记录,下12个月发送提醒。蛋疼的2月.

时间:2014-09-03 19:58:37      阅读:246      评论:0      收藏:0      [点我收藏+]
<form action="" method="get">
年<input type="text"  name="y" value="2014" />月<input type="text"  name="m" value="<?php echo $_GET[‘m‘]; ?>" />日<input type="text"  name="d" value="<?php echo $_GET[‘d‘];?>" />
 <br />
 周期<input type="text"  name="i" value="<?php echo $_GET[‘i‘]; ?>" />
 <br />
 <input type="submit" value="提交">

</form>

<?php

$date=$_GET[‘y‘].‘-‘.$_GET[‘m‘].‘-‘.$_GET[‘d‘];
$return=$date;
$i=$_GET[‘i‘];

$arr=array(29,30);

$Y=date(‘y‘,strtotime($date));

$m=date(‘m‘,strtotime($date));

$d=date(‘d‘,strtotime($date));

for($i;$i>0;$i--)
{

if($d==31){
	
	echo date(‘Y-m-t‘,strtotime("+$i months",strtotime("$Y-$m-5")));
	echo ‘<br>‘;
	continue;

}



 if(in_array($d,$arr)&&($i+$m)%12==2){
 
 $y=date(‘Y‘,strtotime($return));
 
 echo ‘<br >‘;
echo date(‘Y-m-t‘,strtotime("$y-2"));
	
	echo ‘<br />‘;
	continue;
	
 }
 
 $return=date("Y-m-d", strtotime("+$i months", strtotime($date)));
	
//$return=2月的最后一天	
 
 echo $return;

echo ‘<br />‘;
}


实现当前月记录,下12个月发送提醒。蛋疼的2月.

原文:http://my.oschina.net/php2014/blog/309777

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!