如何禁止局域网内微信文件如何传到电脑和微信文件如何传到电脑传文件

2010年6月 PHP大版内专家分月排行榜第二
2010年8月 PHP大版内专家分月排行榜第三
2010年6月 PHP大版内专家分月排行榜第二
2010年8月 PHP大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。最近几天在做一个项目,主要是将SQLserver数据到MySQL数据库,一个url跑一次 同步一次昨天的数据,由于很多数据需要同步,所以做了一个操作界面的,一个单纯跑url的
在其中涉及到了对于时间的计算!当我写完这个程序的时候,我回头看我写的计算时间的代码。有些都有点儿懵了!。。。在这里记录下来方便以后回忆,也方便别人使用!
代码可能会臃肿!新人一枚!欢迎指正!拒绝骂街哦!
先简单说一下代码,其中主要涉及到计算润年 平年,计算28天 31天 30天月份 等,主要就是判断!代码中有注释,大家看一下,希望大家多多指正缺点!
/**一年中的31天的月份
* @var array
private $month_31 = array(1,3,5,7,8,10,12);
/**一年中30天的月份
* @var array
private $month_30 = array(4,6,9,11);
/**查询开始的时间戳
private $startTimeStamp;
/**查询结束的时间戳
private $endTimeStamp;
/-----------------------------------------------计算年月----------------------------------------------------------
/**计算年份是否是闰年,如果是闰年 2月份是29天
平年是28天, 每调用一次这个函数,天数增 加1天
* @return string
时间戳,是经过计算的,前加 '00'
private function computeTime() {
if (($this-&year % 4 == 0 && $this-&year % 100 != 0) || ($this-&year % 400 == 0)) {
$this-&computeTimeDate(29);
$this-&computeTimeDate(28);
/**根据月份是多少天,计算日期时间,
* @param $Feb
private function computeTimeDate($Feb) {
if ($this-&month == 2) {
if($this-&date &= 1 && $this-&date &= $Feb) {
$this-&date = $this-&date + $this-&syncNumD
//如果加默认天数大于当前月份天数,就计算月份
if( $this-&date + $this-&syncNumDate & $Feb ) {
$this-&computeDateMonth();
} else if($this-&date & $Feb) {
$D_value = $this-&syncNumDate - ($Feb - $this-&date);
if( $D_value != 0 ) {
$this-&computeDateMonth($D_value);
$this-&computeDateMonth();
die('2月份天数不在正常范围内');
} else if( in_array($this-&month, $this-&month_30) ) {
if( $this-&date &= 1 && $this-&date & 30 ) {
$this-&date = $this-&date + $this-&syncNumD
if( $this-&date + $this-&syncNumDate & 30 ) {
$this-&computeDateMonth();
} else if($this-&date &= 30){
$D_value = $this-&syncNumDate - (30 - $this-&date);
if( $D_value != 0 ) {
$this-&computeDateMonth($D_value);
$this-&computeDateMonth();
die('30天的月份天数不在正常范围内');
} else if(in_array($this-&month, $this-&month_31)) {
if( $this-&date &= 1 && $this-&date & 31 ) {
$this-&date = $this-&date + $this-&syncNumD
if( $this-&date + $this-&syncNumDate & 31 ) {
$this-&computeDateMonth();
} else if( $this-&date &= 31 ){
$D_value = $this-&syncNumDate - (31 - $this-&date);
if( $D_value != 0 ) {
$this-&computeDateMonth($D_value);
$this-&computeDateMonth();
die('31天的月份天数不在正常范围内');
echo $this-&
die('函数computeTimeDate计算年月日发生错误');
* 计算加减月份,如果超过12 就让年份 +1 月份恢复到1
* @param $D_value
差值,由于在计算天数的时候,存在加值过大,造成的重复计算,例如30+6 可能计算两次,差值就是 30+1 剩下的5天,在新的月份添加
private function computeDateMonth($D_value='') {
if($this-&month &= 1 && $this-&month & 12) {
$this-&month = $this-&month + 1;
if( $D_value != '' ) {
$this-&date = $D_value;
$this-&date = 1;
} else if($this-&month == 12) {
if( $this-&year == date('Y', time()) ) {
$this-&year = $this-&year + 1;
$this-&month = 1;
if( $D_value != '' ) {
$this-&date = $D_value;
$this-&date = 1;
$this-&computeTime();
die('computeDateMonth函数计算错误');
写了以上的代码,也算了解了日期处理的一个过程!对于记忆这个函数更深刻了!~~
其实主要还是自己想写一遍! 至少自己对函数也有一个更好的理解!
以下是用PHP代码实现上面的一堆!
data( 'Y-m-d', strtotime( ' +1 days ' ) );
阅读(...) 评论()2012年2月 PHP大版内专家分月排行榜第一2012年1月 PHP大版内专家分月排行榜第一2011年11月 PHP大版内专家分月排行榜第一2011年9月 PHP大版内专家分月排行榜第一
2012年3月 PHP大版内专家分月排行榜第二2011年12月 PHP大版内专家分月排行榜第二2011年10月 PHP大版内专家分月排行榜第二
2011年11月 PHP大版内专家分月排行榜第二
本帖子已过去太久远了,不再提供回复功能。}

我要回帖

更多关于 微信传文件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信