[英]Laravel: How to access config/Mail variables
I need to get address and name variables on my Mail.php config:我需要在我的 Mail.php 配置中获取地址和名称变量:
'from' => ['address' => env('MAIL_USERNAME'), 'name' => env('MAIL_NAME')],
I tried this:我试过这个:
Config::get('mail.from.*.name');
Config::get('mail.from["name"]');
But it doesn't work, what do I do to get them?但它不起作用,我该怎么做才能得到它们? Thanks.
谢谢。
I think you can directly access MAIL_NAME from .env我认为您可以直接从 .env 访问 MAIL_NAME
env('MAIL_NAME');
OR或
Config::get('mail.from.name');
Hope this work for you !!!希望这对你有用!!!
this is the shortest method i know using helper methods :这是我知道的使用辅助方法的最短方法:
config('mail.from.name')
or you can access it using your .env file with env('MAIL_NAME')
或者您可以使用 .env 文件和
env('MAIL_NAME')
访问它
最好将您的邮件名称放在您的配置文件中,并使用 env 函数访问它,如下所示:
env('MAIL_NAME')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.