Home > php教程 > PHP源码 > body text

php中判断是否是今天程序代码

WBOY
Release: 2016-06-08 17:24:11
Original
1170 people have browsed it

本文章来给大家简单的介绍利用data函数来实现判断是否是今天程序代码

<script>ec(2);</script>
 代码如下 复制代码
echo '';
// 拟设一个日期
$a = '2012-06-28 10:10:10';
// 截取日期部分,摒弃时分秒
$b = substr($a,0,10);
// 获取今天的日期,格式为 YYYY-MM-DD
$c = date('Y-m-d');
// 使用IF当作字符串判断是否相等
if($b==$c){
echo '是今天';
}else{
echo '不是今天';
}
?>
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!