找不到 Laravel 5 类“HTML" [英] Laravel 5 Class 'HTML' not found
问题描述
我正在尝试使用 Laravel 5,但我的 {{ HTML::style('style.css') }}
不再有效.
I am attempting to use Laravel 5 but my {{ HTML::style('style.css') }}
No longer works.
我已更新 composer.json 以在 require 下包含 "illuminate/html": "5.*"
.我已将 'IlluminateHtmlHtmlServiceProvider'
添加到 app.php 下的 providers 数组中,并添加了
I have updated composer.json to include "illuminate/html": "5.*"
under require. I have added 'IlluminateHtmlHtmlServiceProvider'
to my providers array under app.php and I have added
'Form'=> 'IlluminateHtmlFormFacade',
'HTML'=> 'IlluminateHtmlHtmlFacade'
也是.然后我运行 composer update
我已经重新启动 WAMP 以确保它仍然不起作用.我也试过使用 {!!HTML::style('style.css') !!}
也不起作用.我还需要做什么才能恢复它?
as well. I then ran composer update
I have restarted WAMP to make sure and it still does not work. I have also tried to use {!! HTML::style('style.css') !!}
which did not work either. What else do I need to do to get this back?
推荐答案
任何使用 laravel 5.* 的人都必须使用 laravelcollective/html
因为 Package illuminate/html
已弃用,应避免使用.
Anybody who are using laravel 5.* have to use laravelcollective/html
because Package illuminate/html
is abandoned, you should avoid using it.
你的 composer.json
文件应该在 require 部分包含以下代码(因为我使用的是 laravel 5.2,所以它会被称为 5.2)
your composer.json
file should contain following code in require section(as i am using laravel 5.2 it will be mentioned as 5.2)
"laravelcollective/html": "5.2.*"
运行 composer update
并且你的 config/app.php
应该在 providers 数组中包含以下代码
and your config/app.php
should contain following code in providers array
'providers' => [
CollectiveHtmlHtmlServiceProvider::class,
]
和别名应该包含
'aliases' => [
'Form' => CollectiveHtmlFormFacade::class,
'HTML' => CollectiveHtmlHtmlFacade::class,
]
并且请注意,您提到的任何别名都应该在您的代码中显示为
and please note that whatever aliase you mentioned should appear in your code as
{{HTML::linkAction('MemberController@show', 'view', array($value->id))}}
这篇关于找不到 Laravel 5 类“HTML"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!