0

在我的 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 命令更新作曲家:

[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} 

我的代码有什么问题?

4

1 回答 1

0

2 种可能的情况。
1)你进入一个无限循环,耗尽你的记忆。
2)您正在耗尽您设置的内存限制。

如果您在升级laravel时升级了php , 请记住您可以使用的内存有一定的限制。 检查你有。 如果你通过 nginx 运行 laravel,还要确保设置为 nginxphp 5.6 && 5.7
memory_limit
memory_limit

于 2018-03-09T12:05:26.867 回答