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: [php] & lt ;? Php $ fp =... "/> <scripttype =" text/javascript "s
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:
[Php]
$ Fp = fopen ("test.txt", "a + ");
Fwrite ($ fp, date ("Y-m-d H: I: s"). "success! \ N ");
Fclose ($ fp );
?>
$ Fp = fopen ("test.txt", "a + ");
Fwrite ($ fp, date ("Y-m-d H: I: s"). "success! \ N ");
Fclose ($ fp );
?> The program writes it boldly. it is okay to use include \ require.
2. create a Bat file named test. bat. the content is as follows:
D: \ php \ php.exe-q D: \ website \ test. php // change the directory to the correct one.
3. create a WINDOWS scheduled task:
Start C> Control Panel C> task Plan C> add task plan
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 ".
The running process is omitted ............
There is a small problem with the above method. when a task is scheduled to run, the dos window will appear on the windows desktop. here, make some modifications. You can use the vbs method to achieve this without the black dos window. The code is as follows:
DIM objShell
Set objShell = wscript. createObject ("wscript. shell ")
Ireturn = objShell. Run ("C: \ php \ php.exe d: \ www \ timer. php", 0, TRUE)
Save it as a. vbs file and replace it with the original. bat file.