久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      詳解thinkphp5.1/5.0定時(shí)任務(wù)的實(shí)現(xiàn)步驟

      下面由thinkphp教程欄目給大家詳解thinkphp5.1/5.0定時(shí)任務(wù)的實(shí)現(xiàn)步驟,希望對(duì)需要的朋友有所幫助!

      我主要做的是一個(gè)員工生日當(dāng)天發(fā)短信的功能,每天跑一次腳本,

      第一步:

      a.App/模塊/ 下創(chuàng)建command文件夾

      b.我這邊是創(chuàng)建在admin模塊里面,在command文件夾下創(chuàng)建一個(gè)SendMessage.php文件(具體名字自己根據(jù)需求定)

      c.復(fù)制下面的代碼到SendMessage.php

      <?php  namespace appadmincommand;     use thinkconsoleCommand;  use thinkconsoleInput;  use thinkconsoleOutput;  use thinkDb;  use thinkLog;     class SendMessage extends Command  {      protected function configure(){          $this->setName('SendMessage')->setDescription("計(jì)劃任務(wù) SendMessage");      }         //調(diào)用SendMessage 這個(gè)類(lèi)時(shí),會(huì)自動(dòng)運(yùn)行execute方法      protected function execute(Input $input, Output $output){          $output->writeln('Date Crontab job start...');          /*** 這里寫(xiě)計(jì)劃任務(wù)列表集 START ***/             $this->birthday();//發(fā)短信             /*** 這里寫(xiě)計(jì)劃任務(wù)列表集 END ***/          $output->writeln('Date Crontab job end...');      }         //獲取當(dāng)天生日的員工 發(fā)短信      public function birthday()      {          echo '這里寫(xiě)你要實(shí)現(xiàn)的邏輯代碼';      }  }

      第二步:在APP/command.php里面加上

      return ['appadmincommandSendMessage'];

      詳解thinkphp5.1/5.0定時(shí)任務(wù)的實(shí)現(xiàn)步驟

      第三步:設(shè)置crontab計(jì)劃任務(wù)

      1. crontab -l //計(jì)劃任務(wù)列表

      2. crontab -e //編輯新增

      3. crontab -r //刪除

      為了方便測(cè)試,可以先設(shè)置成每分鐘執(zhí)行一次 ,記錄一下日志/www/wwwroot/tool/runtime/message/2019.log

      1. */1 * * * * php /www/wwwroot/tool/think SendMessage>>/www/wwwroot/tool/runtime/message/2019.log 2>&1

      2. //監(jiān)控一下你的腳本是不是正常的

      3. tail -f /www/wwwroot/tool/runtime/message/2019.log

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