Home  >  Article  >  Backend Development  >  Detailed explanation of php scheduled execution task settings_PHP tutorial

Detailed explanation of php scheduled execution task settings_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:07:54742browse

Detailed explanation of php scheduled execution task setting

This article mainly introduces the method of php scheduled execution task setting. It is very simple. Friends who need it can refer to it.

A buddy asked me this question today. The problem is that he has an IIS server and needs to execute a scanning php script regularly. How to do this? It is executed once every hour. Here are the settings for Windows

 1) Double-click Task Scheduler in the Control Panel to open the Windows Task Scheduler window.

2) Double-click to add a task to open the task planning wizard. Click Next.

3) Click to browse and select the program you want to run

 4) Enter the plan name and select Daily

5) Set the starting time, select each day, and the starting date. Next step.

 6) Enter the password, which is the password of the user name of the system (use default). Next step

7) Select to open the advanced properties of this task when you click Finish.

8) In the advanced properties window, select the Schedule tab and select Advanced

9) In the advanced planning options, check the recurring task and set the duration to 24 hours.

10) You can update it once an hour and work 24 hours a day.

Then we continue to solve how to support the scheduled execution of scripts, so we need to write a script, such as test.bat

I installed php to the D drive and used php-cgi.exe

The code is as follows:

 D:

cd php

 php.exe D:/wwwroot/dingshi.php //The path of the script file for scheduled execution

We can test dingshi.php

The code is as follows:

file_put_contents("a.php","test");

Let’s double-click test.bat, and then check whether a.php has written test. The program that our scheduled task runs is test.bat, so it will be executed automatically!

The above is the setting method for scheduled execution of tasks in PHP. It is very simple. Friends can expand it freely. I hope you will like it

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/954517.htmlTechArticleDetailed explanation of php scheduled execution task setting This article mainly introduces the method of setting up php scheduled execution task. It is very simple and has Please refer to it if you need it. A buddy asked me this today...
Statement:
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