Laravel .env variable always returns null

前端 未结 7 2383
误落风尘
误落风尘 2021-01-05 01:14

I added this variable to .env file

STRIPE_SECRET=a12345

I would like to dump the variable using routes/web.php

&         


        
7条回答
  •  难免孤独
    2021-01-05 01:31

    if you have STRIPE="a12345" this in .env file or if you any change in .env file or config file then you fallow these steps

    one more thing write the variable value in comma's like STRIPE="a12345"

    First run these commands

     1. php artisan config:clear
     2. php artisan cache:clear
     3. composer dump-autoload
    

    and finally used this command to get variable

    dd(env('STRIPE'));
    

    this working for me

    and also 1 stupid suggestion: restart server

    I have add all possible solution

提交回复
热议问题