Home > Backend Development > PHP Tutorial > Windows executes PHP files regularly

Windows executes PHP files regularly

angryTom
Release: 2023-04-07 15:32:01
forward
3765 people have browsed it

PHP develops related system programs mainly to facilitate work and management. Timing tasks can implement regular execution, and PHP logic can implement what to do each time it is executed. The two combined can greatly reduce the time and cost of manual intervention. For example, delete logs regularly, back up the database regularly, etc.

1. Write a PHP program and name it cron.php.

2. Create a new Bat file and name it test.bat

The content is as follows:

D:\php\php.exe -q D:\website\cron.php
Copy after login

It should be noted that: php The directory location of the .exe and the location of the cron.php file.

3. Create a WINDOWS scheduled task:

Start->Control Panel->Task Schedule->Add Task Schedule

Browse files Select the test.bat file above

Set the time and password (for logging in to WINDOWS)

Save it.

4. Right-click the scheduled task and click "Run"

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Windows executes PHP files regularly. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:www.leixuesong.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