首页 文章

在cignnel上的codeigniter中的Cron工作不起作用

提问于
浏览
0

我必须在cpanel中使用cron作业,我正在使用CodeIgniter . 我的控制器路径是http://www.example.com/myfolder/application/controllers/cron/cron_controller.php如何在cron中调用我的控制器 .

3 回答

  • 0

    在crontab中简单定义

    0 * * * * php /controllers/cron/cron_controller.php
    

    它会工作,这里*是变量(时间)

    Example of job definition:
    .---------------- minute (0 - 59)
    |  .------------- hour (0 - 23)
    |  |  .---------- day of month (1 - 31)
    |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    |  |  |  |  |
    *  *  *  *  * user-name command to be executed
    
  • 0

    当您尝试运行cron时,您正在从命令行运行,但您仍需要浏览索引 . 所以你的cron命令是:

    * * * * * php index.php cron cron_controller
    

    https://www.codeigniter.com/userguide3/general/cli.html

  • 0

    这是有效的 . 只需在cron选项卡中输入

    wget www.yourdomain.com/index.php/yourcontroller/yourfunction
    

相关问题