php判断时间为空‘0000-00-00 00:00:00'

php里面判断时间是很简单的,之前很多人问我怎么判断php空时间,或者说是‘0000-00-00 00:00:00’,其实php有这样的函数,
strtotime函数就可以用来判断这个来的!

成功则返回时间戳,否则返回 FALSE。在 PHP 5.1.0 之前本函数在失败时返回 -1。

所以,我们在显示时间的时候,判断一下是否为空,

strtotime($date)?$date:'';

猜你喜欢

转载自blog.csdn.net/zhezhebie/article/details/80324437
00