找不到Laravel 5 Class'HTML' [英] Laravel 5 Class 'HTML' not found

查看:89
本文介绍了找不到Laravel 5 Class'HTML'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用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.*".我已将'Illuminate\Html\HtmlServiceProvider'添加到app.php下的提供程序数组中,并且添加了

I have updated composer.json to include "illuminate/html": "5.*" under require. I have added 'Illuminate\Html\HtmlServiceProvider' to my providers array under app.php and I have added

'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade'

也是.然后,我运行composer update我已经重新启动WAMP以确保它仍然无法正常工作.我也曾尝试使用{!! HTML::style('style.css') !!},该{!! HTML::style('style.css') !!}也不起作用.我还需要做些什么才能把它找回来?

as well. I then ran composer updateI 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,因为软件包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应该在提供程序数组中包含以下代码

and your config/app.php should contain following code in providers array

'providers' => [
                       Collective\Html\HtmlServiceProvider::class,

]

和别名应包含

'aliases' => [

                'Form' => Collective\Html\FormFacade::class,
                'HTML' => Collective\Html\HtmlFacade::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 Class'HTML'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆