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

Windows executes PHP files regularly

angryTom
angryTomforward
2019-10-14 16:22:343734browse

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

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!

Statement:
This article is reproduced at:www.leixuesong.cn. If there is any infringement, please contact admin@php.cn delete