I found some methods on the Internet to execute PHP scheduled tasks in WINDOWS. One of them was completely written, but unfortunately I did not pass it. Finally, I had to combine the methods of various schools to make the operation successful.
I found some methods on the Internet to execute PHP scheduled tasks in WINDOWS. One of them was completely written, but unfortunately I did not pass it. Finally, I had to combine the methods of various schools to make the operation successful.
1. Write a PHP program named test. php. The content is as follows:
The Code is as follows:
$ Fp = fopen ("test.txt", "a + ");
Fwrite ($ fp, date ("Y-m-d H: I: s"). "success! \ N ");
Fclose ($ fp );
?>
The program writes it boldly. It's okay to use include \ require.
2. Create a Bat file named test. bat. The content is as follows:
The Code is as follows:
D: \ php \ php.exe-q D: \ website \ test. php
// Change the Directory
3. Create a WINDOWS scheduled task:
Start> Control Panel> Task Scheduler> Add Task Scheduler
Browse the folder and select the above bat file
Set the time and password (for WINDOWS login)
Save it.
4. over! Right-click the scheduled task and click "run ".