我正在尝试使用 codeigniter 通过 cron 作业运行每周电子邮件更新。如果我在浏览器中检查它一切正常,但是当我通过命令行运行它时,它会通过循环一次,然后在将 $message 变量设置为视图时死掉。
日志没有显示任何有用的信息
日志信息
DEBUG - 2013-03-27 20:26:35 --> Email Class Initialized
DEBUG - 2013-03-27 20:26:35 --> File loaded: /email_templates/weekly_user_update.php
DEBUG - 2013-03-27 20:26:36 --> Language file loaded: language/english/email_lang.php
有问题的代码
public function weekly_update(){
$this->load->model('statistics_model','stats');
$this->load->library('email');
$config['mailtype'] = "html";
$this->email->initialize($config);
$users = $this->stats->get_product_users();
echo "Found ".count($users)." user(s).==".PHP_EOL;
echo "--Beginning User Parse--".PHP_EOL;
$count= 0;
foreach($users as $user){
echo " Parsing User ".$user['first_name']." ".$user['last_name']."[".$user['user_id']."]".PHP_EOL;
$this->email->to($user['email']);
$subject = "Weekly Updates for ".date('m/d/Y');
$this->email->subject($subject);
$message = $this->load->view('email_templates/weekly_user_update',$data,TRUE);
$this->email->message($message);
echo " Sending Message to ".$user['email']." '".$subject."'".PHP_EOL;
$this->email->send();
echo " Weekly Update Sent to {$to}!".PHP_EOL;
$this->email->clear();
}
}
请帮助它让我发疯!