简体   繁体   中英

Laravel 5.1 ignores any values inside env()

I am uisn glravel 5.1 and setting up mail service with Mailgun. I've just found that my services file contains lines like the following:

'mailgun' => [
    'domain' => env('<domain>'),
    'secret' => env('<key>'),
],

Now for some reason, these values get ignored as-is. However, if I remove the env() method from the above, it works. So now I have this:

'mailgun' => [
    'domain' => '<domain>',
    'secret' => '<key>',
],

Can anyone explain why this is?

Because by

env('foo');

You are asking for the content of the "foo" constant defined in the .env file. Do you have a constant in your .env file named 'foo'?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM