Home > Backend Development > PHP Tutorial > How to set up a scheduled task to execute PHP files in WINDOWS_PHP Tutorial

How to set up a scheduled task to execute PHP files in WINDOWS_PHP Tutorial

WBOY
Release: 2016-07-21 15:22:38
Original
944 people have browsed it

1. Write a PHP program, named test.php. The content is as follows:

Copy the code The code is as follows:

$fp = fopen("test.txt", "a+");
fwrite($fp, date("Y-m-d H:i:s") . " Success, success! n") ;
fclose($fp);
?>

Write the program boldly, you can use any includerequire, no problem
2. Create a new Bat file and name it test .bat, the content is as follows:
Copy code The code is as follows:

D:phpphp.exe -q D:websitetest .php
//Change the corresponding directory yourself

3. Create a WINDOWS scheduled task:
Start–>Control Panel–>Task Schedule–>Add task schedule
Browse the folder and select the bat file above
Set the time and password (log in to WINDOWS)
Save it.
4. over! You can right-click the scheduled task and click "Run" to try

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324649.htmlTechArticle1. Write a PHP program, named test.php, the content is as follows: Copy the code as follows: ? $fp = fopen("test.txt", "a+"); fwrite($fp, date("Y-m-d H:i:s") . "Successful!...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template