window环境下编写定时器(执行php文件执行)

来源:互联网 发布:上海宏知检测 编辑:程序博客网 时间:2024/06/05 18:29

干货就应该直接进入正题害羞惊讶


执行流程 : 定时器任务定时执行bat文件->执行php文件->执行方法


第一步,创建好目录和文件



polling.bat 文件内容:


D:\SOFT_PHP_PACKAGE\php5.5\php.exe -q D:\timing\polling_page_number\polling.php


polling.php 文件内容:


<?php
  $content = file_get_contents("http://www.xxxx.com/Test/Timing/test_function");
  $fp = fopen("polling.txt", "a+"); 
  fwrite($fp, date("Y-m-d H:i:s") ." polling page number is ok!\r\n"); 
  fclose($fp); 
?> 


第二步,创建创建定时器任务,直接上图

1、

2、

3、

 

4、