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

    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题