久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何獲取系統(tǒng)時(shí)間

      php如何獲取系統(tǒng)時(shí)間

      PHP獲取當(dāng)前系統(tǒng)時(shí)間方法總結(jié)

      一、獲取當(dāng)前時(shí)間戳

      方法1:通過time函數(shù)

      time();

      方法2:通過$_SERVER中的REQUEST_TIME元素

      $_SERVER['REQUEST_TIME'];

      方法3:通過strtotime函數(shù)

      strtotime('now'));

      二、獲取當(dāng)前時(shí)間

      通過date函數(shù)格式化時(shí)間戳

      echo date('Y-m-d h:i:s', time()); // 2018-10-3 15:57:05

      三、時(shí)區(qū)問題
      上述方法都存在時(shí)區(qū)問題,具體解決:

      方法一:php.ini中修改為中國時(shí)區(qū)

      date.timezone = PRC

      方法二:在php文件中臨時(shí)設(shè)置為中國時(shí)區(qū)

      date_default_timezone_set('PRC');

      php獲取當(dāng)前時(shí)間、時(shí)間戳

      首先需要知道的是在php中獲取時(shí)間方法是date(),在php中獲取時(shí)間戳方法有time()、strtotime()。下面分別說明。

      date() 格式為:date($format, $timestamp),format為格式、timestamp為時(shí)間戳(可選)。

      time()返回當(dāng)前時(shí)間的 Unix 時(shí)間戳,沒有參數(shù)。

      strtotime($time, $now) 將任何英文文本的日期時(shí)間描述解析為 Unix 時(shí)間戳。$time 為必填,規(guī)定要解析的時(shí)間字符串;$now 用來計(jì)

      算返回值的時(shí)間戳,如果省略該參數(shù),則使用當(dāng)前時(shí)間。

      php獲取當(dāng)前時(shí)間的毫秒數(shù)

      php本身沒有提供返回毫秒數(shù)的函數(shù),但提供了microtime()方法,它會(huì)返回一個(gè)數(shù)組,包含兩個(gè)元素:一個(gè)是秒數(shù)、一個(gè)是小數(shù)表示的

      毫秒數(shù),我們可以通過此方法獲取返回的毫秒數(shù),方法如下:

      function getMillisecond(){ 	list($s1,$s2)=explode(' ',microtime()); 	return (float)sprintf('%.0f',(floatval($s1)+floatval($s2))*1000);

      推薦教程:PHP視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)