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

php返回当前日期或者指定日期是周几_php技巧

WBOY
Release: 2016-05-16 20:15:16
Original
1146 people have browsed it

PHP星期几获取代码:

复制代码 代码如下:

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

获取中文星期几:

复制代码 代码如下:

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

获取指定日期是:

复制代码 代码如下:

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

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

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template