获取“找不到类HTML" Laravel 4中的错误 [英] Getting "Class HTML not found" error in Laravel 4
问题描述
在Laravel 4(也称为Illuminate)中从事新项目的工作,我试图在我的master.blade.php
模板中创建指向样式表的链接,如下所示:
Working on a new project in Laravel 4 (a.k.a Illuminate) I'm trying to create the link to the style sheet in my master.blade.php
template like so:
{{ HTML::style('css\style.css') }}
但是这引发了一个错误,表明未找到类HTML.是在Laravel 4中将其删除或重命名,还是我忘记了其他内容?
But this throws an error saying the class HTML wasn't found. Has it been removed or renamed in Laravel 4, or am I forgetting anything else?
推荐答案
出于最佳实践的原因,已从L4中删除了生成器类型类,例如HTML ::和Form ::.最好使用path()方法链接为属性来呈现为标签:
The generator type classes such as HTML:: and Form:: have been removed from L4 for best practice reasons. It would be better to render as tag using the path() method to link the attribute :
<link href="{{ path('to/my/style.css') }}" />
我们可能会在以后添加它们,以实现向后兼容.请记住,L4当前处于Alpha状态.
They may be added in later for backwards compatibility, we will see. Please remember that L4 is currently in an alpha state.
谢谢! 戴勒里斯.
这篇关于获取“找不到类HTML" Laravel 4中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!