Scheduling a controller method by Windows task sch

2019-08-02 02:29发布

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条回答
贪生不怕死
2楼-- · 2019-08-02 02:49

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
查看更多
登录 后发表回答