我在 \app\commands\ 创建了 cronjobcommand.php
public function fire() {
$dataArray=tb1::select();
$dataArray->get();
foreach($dataArray as $show){
Mail::send('emails.test', $show, function($message){
$message->to($show['user_address'], $show['email_content']);
$message->subject($show['email_subject']);
});
}
}
我的观点 test.blade.php 如下:
<!DOCTYPE html>
<html lang="en-US">
<head><meta charset="utf-8"></head>
<body>
<h2>This is testing email. {{{ $dataArray->email_content }}}</h2>
<div>This is testing email.</div>
</body>
</html>
当我删除所有变量并对电子邮件地址、内容和主题进行硬编码时,它就会起作用。但是,当我将一些变量传递到 Mail::send 部分时,它会失败.....
请帮忙