未定义的命名空间 html(将 css 文件添加到 blade)laravel

Undefined namespace html (adding a css file to blade) laravel

我在将位于 public/css 的 css 样式 sheet 导入位于 resources/views/includes.[=22 的 blade 文件中时遇到问题=]

我在blade文件中使用的代码是

{{ HTML::style('css/layout.css') }}

这没用。我也试过

{{ HTML::style('css/layout.css', array('media' => 'print')) }}

我得到的错误是 Class 'HTML' 未找到

我按照this question中的步骤操作,所以

  1. 我在 composer.json
  2. 中添加了 "laravelcollective/html": "5.4.16"
  3. 运行作曲家更新
  4. 加入config/app。php

    'providers' => [
    Collective\Html\HtmlServiceProvider::class,
    ]
    
  5. 'aliases' => [
    
            'Form' => Collective\Html\FormFacade::class,
            'HTML' => Collective\Html\HtmlFacade::class,
    ]
    

现在我得到的错误是

Class 'Collective\Html\HtmlServiceProvider' not found

而且我不明白为什么,因为我将它添加到 app.php。事实上,当我转到 app.php 和我添加 Collective.. 的行时,"Html" 显示为红色,当我将鼠标悬停在它上面时它显示

Undefined namespace Html

我该怎么办? laravel 这一切让我感到困惑。

除了我不知道该怎么办,

{{HTML::linkAction('MemberController@show', 'view', array($value->id))}}

我在网上找不到任何关于 "linkAction"

的论点

1:删除 composer.json 中的 "laravelcollective/html": "5.4.16" 并在 config/app.php.

中清除此包的其他配置

2:运行 composer update

3:运行 composer require laravelcollective/html

4:在config/app.php中添加'Collective\Html\HtmlServiceProvider::class',(供应商)

5:在config/app中添加'Form' => Collective\Html\FormFacade::class,'Html' => Collective\Html\HtmlFacade::class,.php(别名)

6:在控制器中尝试 use Html;use Form;

如果您遇到任何其他错误,请分享 composer.json 和 config/app.php.