【推荐】判断是否今天/昨天 函数//=============================================<br>
//本代码并非完美,也许存在不良之处,高手请多指点,请勿吐槽!<br>
//作者 小曾 Qq839024615 可加我一起交流<br>
//=============================================<br>
<br>
//在我们开发cms系统的时候(自己的小系统哈) 反不是写模板都算开发系统哈<br>
//我们有时会用到判断是否今天的数据,昨天的数据,取今天的数据,取昨天的数据<br>
//等等这样要用到的哈<br>
<br>
//取今天<br>
function JtColor($time){<br>
date_default_timezone_set('Asia/Shanghai');<br>
$jt=strtotime(date('Y-m-d',time()).' 00:00:00');<br>
if($time>$jt){<br>
return 1; //如果是返回1<br>
}else{<br>
return 0; //如果不是返回0<br>
}<br>
}<br>
<br>
//取昨天到现在<br>
function ZtColor($time){<br>
date_default_timezone_set('Asia/Shanghai');<br>
$jt=strtotime(date('Y-m-',time().(date('m',time())-1).' 00:00:00');<br>
if($time>$jt){<br>
return 1; //如果是返回1<br>
}else{<br>
return 0; //如果不是返回0<br>
}<br>
}<br>
<br>
//下面看我们怎么用哈<br>
//假如我们取一个用户今天是否留言<br>
<br>
$is=M('留言')->order('time desc')->find();//以留言时间排列<br>
if(JtColor($is['time'])){<br>
echo "如果返回1代表今天留言过";<br>
}else{<br>
echo "如果返回0那么最后的留言时间,不在今天,也就是大于0点之后没有发表过";<br>
}<br>
<br>
<br>
//=============================================<br>
//本代码并非完美,也许存在不良之处,高手请多指点,请勿吐槽!<br>
//作者 小曾 Qq839024615 可加我一起交流<br>
//=============================================
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software