The implementation idea is as follows: a batfile is executed at a time through the winmtr task logging function, and the batfile will be called with the php.exefile. php.exe can pass parameters to specify the class and method to be executed.
The method is as follows:
1. Enable cli support for thinkphp1. tp supports cli command mode. The path of the Manual is 13.7.4. If other frameworks do not support cli, you can only write programs directly, it is actually the most basic php code for process-oriented writing. 2. Open the command in the entry file and add a define Statement ('mode _ name', 'cl ');Websites generally have modules that can be accessed through web pages. Therefore, you can create a cli entry, such as index_cli.php, so that other modules can be accessed through the normal portal. In some manuals, the cli defines define ('Think _ MODE', 'Cli ');May be different versions. note this.
Ii. Create a new bat fileCreate a txt file with the following three lines: d: cd D: \ workspace \ dzx2php.exe D: \ workspace \ dzx2 \ index_cli.php Sms/sendjob> c: \ smslog.txt indicates that the current directory is moved to drive D, and the current directory is moved to drive D: \ workspace \ zookeeper). The simple method is to move the current directory to the project access file, and the php.exe + absolute path project entry file + Parameter
Change the txt file to an executable file with the bat suffix and click test whether the execution method is correct (you can write a Pause at the end of the bat file to check whether an error is reported or directly write "> c: \ smslog.txtThe output content is imported to a txt file. After running the file, you can check whether the file is reported or not)
3. Create a task
In win, yesControl Panel --> Administrative Procedures --> Task Scheduler right-click the task scheduler library-> create an account for running a task, and you must have the permission trigger-> CreateSelect Frequency and other functions-> NewSelect the Startup ProgramFind the bat file you have written and view the other files by yourself.
After the task is created, click "run" to run the program. Check whether the running time and result of the task have been completed by the program,
If there is a mistake, note that it containsThe selected user permissions, the paths are correct, and the programs are correct.So generally, first, ensure that the program runs OK by accessing the url address, then click the bat file to run the program OK, and then run the task plan OK. Other reference articles: scheduled task behavior extension php automatic php File Execution