doutonghang2761 2013-11-18 23:13
浏览 73

调度PHP CodeIgniter或任何PHP应用程序

I'm trying to schedule my Controller Method in PHP CodeIgniter; I mean I need to call a controller method on specified times!My server is a Windows Server!

So far I followed the following article (http://amitdhamu.com/blog/automating-php-using-task-scheduler/) which schedules a PHP file (calls whole of the PHP File, but I need to call just a controller method!); then I researched and someone at "Scheduling a controller method by Windows task scheduller" said I can do it by:

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

sample:

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

I guess he meant something like :

php C:\xampp\htdocs\Project1\application\controllers\site.php test

Which test method is inside my "site" controller! But this one did not work either!

Could you please how I use schedulig to call a controller method on specified times for a Windows Server?

Thanks

  • 写回答

2条回答 默认 最新

  • dsf5632 2013-11-18 23:20
    关注

    I don't have any experience doing this, but Googling I managed to pull this together:

    schtasks /create /tn "Test Cron Job" /tr "C:\PHP5\php.exe -f C:\xampp\htdocs\Project1\application\controllers\site.php" /sc hourly
    

    This will run hourly. I don't think you can specify a specific method, though you can add specific command line arguments.

    Sources: http://php.net/manual/en/install.windows.commandline.php and http://drupal.org/node/31506

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型