在我的laravel应用程序中,我创建了一个发送电子邮件的帮助程序。
帮助代码:
public static function send_email($page,$subject,$email,$email_data) {
try {
$site_url=url('/');
$email_data['site_url'] = $site_url;
Mail::queue($page, array('email_data' => $email_data), function ($message) use ($email, $subject) {
$message->to($email)->subject($subject);
});
\Log::info("Email Sent ");
} catch(\Exception $e) {
\Log::info("Email Error ".print_r($e , true));
return Helper::error_message(109);
}
}
我试图通过composer update命令更新composer,之后我的邮件功能停止工作并发出此异常错误消息:
[2018-03-09 11:21:22] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException'
with message 'Allowed memory size of 268435456 bytes exhausted
(tried to allocate 252182528 bytes)' in /home/ubuntu/thumbtack-base/app/Helpers/Helper.php:708
Stack trace:
#0 {main}
我的代码出了什么问题?
答案 0 :(得分:0)
2种可能的情况。
1)你进入一个无限循环,耗尽你的记忆
2)你正在耗尽你设定的记忆力限制。
如果您在升级 laravel 时升级了 php ,请记住php 5.6 && 5.7
对内存设置了限制,您可以使用。
检查您的memory_limit
如果你通过nginx运行laravel,也要确保memory_limit
设置为nginx