如何从cron作业将参数传递给编码函数


How to pass parameter to a codigniter function from cron job?

我使用的是codeigniter框架。我试图通过一个参数从玉米标签函数。下面我张贴了我的代码和cron命令。

class Test extends CI_Controller {
    public function index(){
        $this->home(); //shows the home function
    }
    public function my_test($parameter)
    {
      //do something here using $parameter;
    }
 }

cron job命令

10 5 * * * * /usr/bin/php /var/www/myproject/index.php 'test/my_test/2'

请告诉我我做错了什么。

Thanks in advance

我建议您使用wget和cronjobs

wget http://example.com/index.php/controller/method/paramValue

我有同样的问题,然后转换为使用wget

我知道你想知道是什么错了,但我希望这能帮助到你:)