Scheduling a controller method by Windows task scheduller

耗尽温柔 提交于 2019-12-14 02:22:30

问题


I'm following this tutorial (http://amitdhamu.com/blog/automating-php-using-task-scheduler/) to schedule a task in PHP Codeignitre, however in step 1 of the mentioned tutorial I dont know how I can pass the controller method instead of a whole php file?! Could you please help me in this regard?

Also I need to provide the option of scheduling for the admin of my web application as well in a way that they can change the scheduleer; is there any way that I can pass the task manager options with PHP?

Please if my question is not clear, please let me know which part you need more clarification

PS: I have a windows server!

Thanks


回答1:


If you want to execute CodeIgniter code from schedule, replace the call, in .bat:

from:

php C:\Apache\htdocs\automatic.php

to:

php C:\Apache\htdocs\index.php myController <myMethod> <arg1> <arg2>

sample:

php C:\Apache\htdocs\index.php users update


来源:https://stackoverflow.com/questions/19479494/scheduling-a-controller-method-by-windows-task-scheduller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!