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 portal file and add a define ('mode _ name', 'cl'). The website generally has modules that can be accessed through webpages, therefore, you can create a cli entry such as index_cli.php, so that other modules can enter through the normal portal. In some manuals, the cli defines define ('Think _ mode', 'cli '). It may be of different versions. Pay attention to 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.txt "bar imports the output content to a txt file. After running the file, you can check whether the error is returned or not)
3. Create a task
In win, choose Control Panel> management program> Task Scheduler, right-click the task scheduler library, and choose Create task running account. You must have the permission trigger. In other words, choose frequency, and perform other operations. -"Create and select the Startup Program. Find the bat file you have written below and check 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