Home > php教程 > php手册 > php 输出昨天,今天,明天是星期几的方法

php 输出昨天,今天,明天是星期几的方法

WBOY
Release: 2016-06-21 08:49:06
Original
1104 people have browsed it

php分别输出昨天,今天,明天是星期几的方法。主要是由如下这个方法演变而来的,读者可自己研究:

php判断今天是星期几的方法

下面是具体的各种实现代码:

<?php //php判断某一天是星期几的方法
function getWeek($unixTime=''){
	$unixTime=is_numeric($unixTime)?$unixTime:time();
	$weekarray=array('日','一','二','三','四','五','六');
	return '星期'.$weekarray[date('w',$unixTime)];
}
//php输出昨天是星期几
echo getWeek(strtotime('-1 days'));
//php输出今天天是星期几
echo getWeek();
//php输出明天是星期几
echo getWeek(strtotime('+1 days'));
Copy after login



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