php 日期,php_PHP教程

WBOY
發布: 2016-07-13 10:08:20
原創
924 人瀏覽過

php 日期,php

<span> 1</span>     <span>/*</span><span>*
</span><span> 2</span> <span>     *    日期-获取当月最后一天
</span><span> 3</span> <span>     *  @return int
</span><span> 4</span>      <span>*/</span>
<span> 5</span>     <span>public</span> <span>function</span><span> get_lastday() {
</span><span> 6</span>         <span>if</span>(<span>$this</span>->month==2<span>) {
</span><span> 7</span>             <span>$lastday</span> = <span>$this</span>->is_leapyear(<span>$this</span>->year) ? 29 : 28<span>;
</span><span> 8</span>         } <span>elseif</span>(<span>$this</span>->month==4 || <span>$this</span>->month==6 || <span>$this</span>->month==9 || <span>$this</span>->month==11<span>) {
</span><span> 9</span>             <span>$lastday</span> = 30<span>;
</span><span>10</span>         } <span>else</span><span> {
</span><span>11</span>             <span>$lastday</span> = 31<span>;
</span><span>12</span> <span>        }
</span><span>13</span>         <span>return</span> <span>$lastday</span><span>;
</span><span>14</span> <span>    }
</span><span>15</span>     
<span>16</span> 
<span>17</span>     
<span>18</span>     <span>/*</span><span>*
</span><span>19</span> <span>     *    日期-是否是闰年
</span><span>20</span> <span>     *  @return int
</span><span>21</span>      <span>*/</span>
<span>22</span>     <span>public</span> <span>function</span> is_leapyear(<span>$year</span><span>) {
</span><span>23</span>         <span>return</span> <span>date</span>('L', <span>$year</span><span>);
</span><span>24</span>     }
登入後複製

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/951421.htmlTechArticlephp 日期,php 1 /* * 2 * 日期-获取当月最后一天 3 * @return int 4 */ 5 public function get_lastday() { 6 if ( $this -month==2 ) { 7 $lastday = $this -is_leapyear( $this...
相關標籤:
php
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板