たとえば、定期的に実行する必要のあるスクリプトがあります。
アイデア1:最初にウィンドウタイミングタスクを開始します。
方法:ウィンドウの下で定期的にphpファイルを実行します(ウィンドウの下に時限タスクを追加します)
アイデア2:curlを使用してこのタスクを実行します。
まず、Windowsバージョンのcurlをインストールします。インストールリンク:https://blog.csdn.net/weixin_42433970/article/details/112234990
方法:
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/11/12
* Time: 11:09
*/
file_put_contents('v999.log', date('Y-m-d H:i:s', time()) . '执行了一次定时任务git pull。' . PHP_EOL, FILE_APPEND);
//$savePath = "D:\phpstudy_pro\WWW\api.321.design";
//$gitPath = "https://gitee.com/www321design/api.321.design.git";
//
//shell_exec("cd {$savePath} && git pull {$gitPath}");//拉去代码
shell_exec("curl http://fsdfd33333sfsdf.com/crontab/crontab/updateTrackInfoBendi");//拉去代码
//require 'public/settingImgURL.php';