Laravel 5.2 .env sometimes doesn't load in time

前端 未结 2 1906
一向
一向 2021-01-26 07:58

I\'m reading some configurables from my .env file. These configurables are used in various places within the project. A few times i\'ve received an exception that one of the env

2条回答
  •  日久生厌
    2021-01-26 08:43

    That's not really a Laravel error.

    You should set a default date.timezone in your php.ini file, that will take care of your warning.

    On top of that, instead of doing the ini_set in your AppServiceProvider, use

    'timezone' => env('TIMEZONE', '[whatever default value you want]'),
    

    in config/app.php

提交回复
热议问题