A problem where the Laravel framework program could not read the contents of .env.

Spent two nights finding the cause, really killed me.

Laravel cannot display env(‘APP_URL’)

Laravel cannot read the contents of .env

The frontend compiled by VEU opens and jumps to /null after one second

It’s the Laravel backend API issue

Give .env permission 755

php artisan config:clear

php artisan cache:clear

php artisan config:cache

if (count($notice)) {

$bannerlist = [];

foreach ($notice as $val) {

$bannerlist[] = [

‘src’ => env(‘APP_URL’) . ‘/uploads/’ . $val[‘src’],

‘background’ => ‘#f4f6ff’,

‘url’ => $val[‘jump_url’]

];

}

}

return $this->returnMsg(200, $bannerlist);

The env(‘APP_URL’) in this code is not displaying.

The database password in .env should not contain any symbols.