久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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如何利用服務(wù)器實(shí)現(xiàn)定時(shí)任務(wù)?

      本篇文章給大家介紹一下PHP如何利用服務(wù)器實(shí)現(xiàn)定時(shí)任務(wù)?有一定的參考價(jià)值,有需要的朋友可以參考一下,希望對(duì)大家有所幫助。

      PHP如何利用服務(wù)器實(shí)現(xiàn)定時(shí)任務(wù)?

      利用服務(wù)器實(shí)現(xiàn)簡(jiǎn)單的定時(shí)任務(wù),Windows的計(jì)劃任務(wù),Linux的cron,適用于每天某一特點(diǎn)時(shí)間執(zhí)行

      1.windows下定時(shí)訪(fǎng)問(wèn)指定url

      windows下用定時(shí)任務(wù)執(zhí)行auto.php文件, auto.php文件里用curl請(qǐng)求指定的接口實(shí)現(xiàn)

      auto.php 代碼如下

      function doCurlGetRequest($timeout = 5){     $url = 'http://127.0.0.1:81/index.php?s=/Admin/Index/dayBonus.html';     $con = curl_init((string)$url);     curl_setopt($con, CURLOPT_HEADER, false);     curl_setopt($con, CURLOPT_RETURNTRANSFER,true);     curl_setopt($con, CURLOPT_TIMEOUT, (int)$timeout);      return curl_exec($con); } $result = doCurlGetRequest(); var_dump( $result); die;

      新建bat文件命令如下

      C:phpStudyPHPTutorialphpphp-7.2.1-ntsphp.exe -q C:zxauto.php

      php路徑:

      C:phpStudyPHPTutorialphpphp-7.2.1-ntsphp.exe

      auto.php路徑:C:zxauto.php

      window 計(jì)劃任務(wù)

      2.linux下請(qǐng)求url

      Linux上使用CronTab定時(shí)執(zhí)行

      執(zhí)行 crontab -e

      進(jìn)入編輯模式增加一行

      * * * * curl https://www.aaa.com/aaa.php

      前面一部分是時(shí)間,后面操作內(nèi)容。

      30 * * * *

      30就是每小時(shí)分鐘數(shù)為30時(shí),執(zhí)行。

      時(shí)間參數(shù)由以下幾部分構(gòu)成

      分 時(shí) 日 月 周

      第1列表示分鐘1~59 每分鐘用或者 */1表示,/n表示每n分鐘,例如*/8就是每8分鐘的意思

      第2列表示小時(shí)0~23

      第3列表示日期1~31

      第4列表示月份1~12

      第5列標(biāo)識(shí)號(hào)星期0~6

      推薦學(xué)習(xí):php視頻教程

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