Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我想使用codeigniter脚本运行cron作业_Codeigniter - Fatal编程技术网

我想使用codeigniter脚本运行cron作业

我想使用codeigniter脚本运行cron作业,codeigniter,Codeigniter,脚本代码 class Deposit extends MY_Controller { public function coinPaymentCron() { $this->load->model('user_model','apimodel'); $apikeys = $this->apimodel->getApiKey(); foreach ($apikeys as $keysapi) {

脚本代码

class Deposit extends MY_Controller
{
   public function coinPaymentCron()
    {
         $this->load->model('user_model','apimodel');

        $apikeys = $this->apimodel->getApiKey();

        foreach ($apikeys as $keysapi) {
            # code...
            $publickey = $keysapi->public_key;

            $privatekey = $keysapi->private_key;
        }

        $cps = new CoinPaymentsAPI();

        $cps->Setup($privatekey, $publickey);

        $getTxIds = $this->apimodel->gettxids();

        foreach ($getTxIds as $txid) {
            # code...

            $tx_id = $txid->txn_id;

            echo $tx_id;

            $txinfo = $cps->gettxinfo($tx_id);

            if ($txinfo['error'] == 'ok') {
                # code...
                $statusText = $txinfo['result']['status_text'];

                $amountReceived = $txinfo['result']['receivedf'];

                $statusPayment = $txinfo['result']['status'];

                $this->apimodel->updateStatus($tx_id, $statusText);
            }
        }
    }
}
我用于运行cron作业的代码命令是

/usr/local/bin/php /home/name/public_html/index.php deposit coinPaymentCron
我也尝试过很多方法,比如使用wget和curl,但不幸的是没有一种方法适合我。 还使用url检查了脚本,脚本运行正常,正在更新数据库,但cron作业未运行。 其他一些cron作业正在使用此方法运行

/usr/local/bin/php /home/name/public_html/index.php

有人能帮我解决这个问题吗?或者让我知道我做错了什么?

因为我知道有很多方法可以调用CodeIgniter的功能,例如

这个解决方案对我有用

php /full-path-to-cron-file/cron.php /deposit/coinPaymentCron
此外,您还可以尝试以下方法:

wget example.com/index.php/deposit/coinPaymentCron


但您阅读了本教程:并按照说明进行操作。这将对您有所帮助。

据我所知,有很多方法可以调用CodeIgniter的函数,例如

这个解决方案对我有用

php /full-path-to-cron-file/cron.php /deposit/coinPaymentCron
此外,您还可以尝试以下方法:

wget example.com/index.php/deposit/coinPaymentCron

但您阅读了本教程:并按照说明进行操作。它将对您有所帮助。

可能的副本