When I run:
php artisan route:cache
It throws error:
In app.php line 3:
Constant XXX already defined
in my config/app.php, I defined some global constants, such as:
define("XXX", "xxx");
If I removed them, no error thrown anymore.
I wonder if I want to keep those constants in config files, is there any way to avoid this problem?
You can not do this in such way. If you want to add any new item in config/app.php
, just try this way:
config/app.php
file, Add 'XXX' => 'xxx'
.2.When you want to call this variable, use it config('app.XXX')