首頁 > 後端開發 > php教程 > PHP 這個週一到週日是幾月幾號?

PHP 這個週一到週日是幾月幾號?

WBOY
發布: 2016-07-29 09:12:02
原創
1704 人瀏覽過

<code>    header(<span>"content-type:text/html;charset=utf-8"</span>);
    date_default_timezone_set(<span>'PRC'</span>);
    <span><span>function</span><span>getWeek</span><span>(<span>$unixTime</span>=<span>''</span>)</span>{</span><span>$unixTime</span>=is_numeric(<span>$unixTime</span>)?<span>$unixTime</span>:time();
        <span>$weekarray</span>=<span>array</span>(<span>'日'</span>,<span>'一'</span>,<span>'二'</span>,<span>'三'</span>,<span>'四'</span>,<span>'五'</span>,<span>'六'</span>,<span>'七'</span>);
        <span>return</span><span>"星期"</span>.<span>$weekarray</span>[date(<span>'w'</span>,<span>$unixTime</span>)];
    }

    <span>$var</span>=getWeek();

    <span>switch</span>(<span>$var</span>){
        <span>case</span><span>'星期天'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-(<span>84600</span>*<span>6</span>);
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期一'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>;
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期二'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-<span>84600</span>;
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期三'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-(<span>84600</span>*<span>2</span>);
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期四'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-(<span>84600</span>*<span>3</span>);
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期五'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-(<span>84600</span>*<span>4</span>);
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
        <span>case</span><span>'星期六'</span>:
            <span>$var</span>=time();
            <span>$var2</span>=<span>$var</span>-(<span>84600</span>*<span>5</span>);
            <span>echo</span><span>"这个星期一是"</span>.date(<span>"Y-m-d"</span>,<span>$var2</span>).<span>"号"</span>;
        <span>break</span>;
    }</code>
登入後複製
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介紹了PHP 這個週一到週日是幾月幾號? ,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板