PHP -- 计算过去某天到今天的天数

今天想知道和qe在一起多少天了,懒得拿笔计算,于是:

<?php
header("Content-type: text/html; charset=utf-8");
$d1 = strtotime("November 5 2015");//过去的某天,你来设定
$d2 = 1 + ceil((time()-$d1)/60/60/24);//现在的时间减去过去的时间,ceil()进一函数
echo "一共" . $d2 ." 天。";
?>

简简单单,也是一种幸福!

欢迎补充!

QE大狮子!


猜你喜欢

转载自blog.csdn.net/hongyuancao/article/details/80387107
php