我正在遵循一个教程,他继续更改 <title></title>
里面的标签index.blade.php
使用config()
。我正在做他正在做的同样的事情,但由于某种奇怪的原因,这对我不起作用。
我做错了什么以及如何解决它?
这是index.blade.php
:
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{config('app.name', 'LSAPP')}}</title>
</head>
<body>
</body>
</html>
这是PagesController.php
:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PagesController extends Controller
{
public function index() {
return view('pages.index');
}
}
这是web.php
:
Route::get('/', 'PagesController@index');
这是我的 .env
的一部分文件:
APP_NAME=LSAPP
最佳答案
尝试运行php artisan config:cache
它将清除旧的 .env 文件并缓存新的文件。
关于php - 为什么我的标题标签不能使用 config() 更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54607842/