【发布时间】:2014-03-03 08:50:18
【问题描述】:
我想做一个 cronjob 来向用户发送有关某事的提醒??
我正在使用带有模块方法的 codeigniter 框架。
这是我最后一次尝试:
0 7 3 * * /usr/bin/php index.php cli/cart_reminder
虽然我使用模块,但我在 Controllers 文件夹中制作了一个单独的控制器
这是我的代码:
class Cart_Reminder extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('input');
$this->load->library('email');
$this->load->model('cart_reminder_model','cart_reminder');
}
public function index()
{
// if(!$this->input->is_cli_request())
// {
// echo "greet my only be accessed from the command line";
// return;
// }
$emails=$this->cart_reminder->get_emails();
foreach($emails as $em):
$msg=$em['bo_name'].'\r\n';
$msg.="هذه الكتب قد فمت بإضافتهالسلة المشتريات من قبل ولم تقم بإكمال عملية الشراء لإكمال عملية الشراء اضغط هنا ";
$msg.="<a href='".base_url()."paypal/cart'>اضغط هنا</a>";
$this->email->to($em['user_email']);
$this->email->from($this->option->get('site_email'));
$this->email->subject("رسالة تذكير");
$this->email->message($msg);
$this->email->send();
endforeach;
}
}
现在它不起作用并以管理员身份向我发送此邮件:
/usr/local/cpanel/bin/jailshell: 0: 找不到命令
【问题讨论】:
标签: php codeigniter cron