Set the method in WINDOWS to schedule the task to execute the PHP file
- 2020-05-10 17:53:04
- OfStack
1. Write an PHP program, named test.php, as follows:
Program bold write, what include\require use, no problem
2. Create a new Bat file and name it test.bat, as follows:
3. Set up WINDOWS plan tasks:
Start � > Control panel. > Mission planning questions: > Add task plan
Browse the folder and select the bat file above
Set time and password (log in WINDOWS)
Save it.
4, over! You can try "run" by right-clicking the schedule task
<?
$fp = fopen("test.txt", "a+");
fwrite($fp, date("Y-m-d H:i:s") . " Success! Success! \n");
fclose($fp);
?>
Program bold write, what include\require use, no problem
2. Create a new Bat file and name it test.bat, as follows:
D:\php\php.exe -q D:\website\test.php
// Change the corresponding directory yourself
3. Set up WINDOWS plan tasks:
Start � > Control panel. > Mission planning questions: > Add task plan
Browse the folder and select the bat file above
Set time and password (log in WINDOWS)
Save it.
4, over! You can try "run" by right-clicking the schedule task