Home >Backend Development >PHP Tutorial >php返回当前日期或者指定日期是周几_PHP

php返回当前日期或者指定日期是周几_PHP

WBOY
WBOYOriginal
2016-05-30 08:47:40803browse

PHP星期几获取代码:

代码如下:


date("l"); //data就可以获取英文的星期比如Sunday
date("w"); //这个可以获取数字星期比如123,注意0是星期日

获取中文星期几:

代码如下:


$weekarray=array("日","一","二","三","四","五","六"); //先定义一个数组
echo "星期".$weekarray[date("w")];

获取指定日期是:

代码如下:


$weekarray=array("日","一","二","三","四","五","六");
echo "星期".$weekarray[date("w","2011-11-11")];


以上所述就是本文赌钱不内容了,希望大家能够喜欢。

Statement:
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