Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<meta name="description" content="{{ $description }}" />
它是一个存储在custom.config.php. 该文件可以在任何地方。(我是 Laravel 的新手)
custom.config.php
如何确保 Laravel 每次都运行它?我不会->with('description', $description');每次调用视图时都使用它。
->with('description', $description');
寻找类似的东西:{{ Config::get('website_description') }}
{{ Config::get('website_description') }}
您可以将该变量添加到之前的路由过滤器:
Route::filter('before', function() { //Do stuff before every request to your application... $website_description = Config::get('website_description'); View::share('website_description', $website_description); });
然后,您可以在视图中直接访问该变量。