Php 拉威尔5级';表格';找不到
我在composer.json中添加了“illumb/html”:“5.*”,并运行了“composer更新” 我在网站的根目录下运行了这个命令。我修改了/root/.composer中的composer.json文件。。。从项目的根本上来说,两者都没有什么不同 这下载了这个类,它似乎已经安装好了。我已经在config/app.php文件中添加了以下内容 我想我知道哪里出了问题,但我不知道如何解决。我的安装在“/var/www/website”中。我已经检查了文件路径,Html文件夹不存在Php 拉威尔5级';表格';找不到,php,laravel,composer-php,Php,Laravel,Composer Php,我在composer.json中添加了“illumb/html”:“5.*”,并运行了“composer更新” 我在网站的根目录下运行了这个命令。我修改了/root/.composer中的composer.json文件。。。从项目的根本上来说,两者都没有什么不同 这下载了这个类,它似乎已经安装好了。我已经在config/app.php文件中添加了以下内容 我想我知道哪里出了问题,但我不知道如何解决。我的安装在“/var/www/website”中。我已经检查了文件路径,Html文件夹不存在 "/
"/var/www/website/vendor/laravel/framework/src/Illuminate/Html"
我能够找到类文件,但在不同的目录中
"/var/www/website/vendor/illuminate/html"
我手动将文件复制到主Laravel/html文件夹,但这也不起作用。这可能不是您想要的答案,但我建议使用现在由社区维护的存储库,因为主存储库已被弃用
Laravel Collective正在更新其网站。如果需要,您也可以。您还可以尝试在Terminal或Command中运行以下命令:
composer dump auto
或composer dump auto-o
php artisan配置:清除
上述内容对我很有用。
表单
未包含在laravel
5.0中,因为它在4.0中,包含它的步骤如下:
首先通过Composer
安装laravelcollective/html
软件包。编辑项目的composer.json
文件以要求:
"require": {
"laravelcollective/html": "~5.0"
}
接下来,从终端更新composer
:
composer update
composer update
接下来,将新的提供者添加到
config/app.php
的providers
数组中:
'providers' => [
// ...
'Collective\Html\HtmlServiceProvider',
// ...
],
'aliases' => [
// ...
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
// ...
],
最后,将两个类别名添加到
config/app.php
的alias
数组中:
'providers' => [
// ...
'Collective\Html\HtmlServiceProvider',
// ...
],
'aliases' => [
// ...
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
// ...
],
此时,
表单
应该可以工作了
更新
Laravel 5.8
(2019-04-05):
在Laravel 5.8
中,config/app.php
中的提供者可以声明为:
Collective\Html\HtmlServiceProvider::class,
而不是:
'Collective\Html\HtmlServiceProvider',
此符号与别名相同。Laravel 5.2对此进行了更新。请注意,这与上面所示的格式略有不同
首先通过Composer安装此软件包。编辑项目的composer.json文件以要求使用laravelcollective/html
"require": {
"laravelcollective/html": "5.2.*"
}
接下来,从终端更新Composer:
composer update
composer update
接下来,将新的提供者添加到config/app.php的提供者数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
最后,将两个类别名添加到config/app.php的别名数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
进行此更新后,此代码在新安装的Laravel 5.2上对我有效:
{!! Form::open(array('url' => 'foo/bar')) !!}
//
{!! Form::close() !!}
我在这里得到了这些信息:使用表单
,而不是表单
。大小写计数。首先通过Composer安装此软件包。从终端运行以下命令:
composer require "laravelcollective/html":"^5.3.0"
接下来,将新的提供者添加到config/app.php的提供者数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
最后,将两个类别名添加到config/app.php的别名数组中:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
SRC:
在Laravel版本-4中,HTML和表单已经存在,但不是现在
原因:
唯一的原因是他们收集了一些用户需求,他们希望它更轻量级,因此他们删除了它,因为用户可以手动添加它
如何在Laravel 5.2或5.3中添加HTML和表单:
对于5.2:
请转到已演示其功能的安装过程
与5.2类似:在命令行上,运行命令
composer require "laravelcollective/html":"^5.2.0"
composer require "laravelcollective/html":"^5.3.0"
然后,在config/app.php中的提供者数组中。最后使用逗号(,)添加此行:
为了使用HTML和表单文本,我们需要在config/app.php的别名数组中对它们进行别名。在最后添加两行
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
而对于5.3:
只需运行命令
composer require "laravelcollective/html":"^5.2.0"
composer require "laravelcollective/html":"^5.3.0"
程序的其余部分类似于5.2
然后,您可以在项目中使用Laravel表单和其他HTML链接。为此,请遵循以下文档:
5.2:
5.3:
演示代码:
要打开表单,请打开和关闭标记:
{!! Form::open(['url' => 'foo/bar']) !!}
{!! Form::close() !!}
以及使用引导表单控件类创建标签和输入文本以及其他用途:
{!! Form::label('title', 'Post Title') !!}
{!! Form::text('title', null, array('class' => 'form-control')) !!}
有关更多信息,请使用文档。只需在项目目录的terminal中键入以下命令,即可根据Laravel版本完成安装:
composer require "laravelcollective/html"
然后在config/app.php
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
我尝试了所有方法,但只有这一点起到了作用:
php artisan route:clear
php artisan cache:clear
知道为什么在v5中删除了它吗?似乎他们想让它更轻量级,让人们只在需要时添加东西。他们在升级指南或其他地方注意到了吗?没有看到它。谢谢,我不知道这是laravel的新功能,它仍然在主文档中,所以我不知道这不在v5中。SRC链接已更新。从5.0到5.3,他们更改了提供者和别名部分。Collective\Html\HtmlServiceProvider::class,用于提供者,然后是'Form'=>Collective\Html\FormFacade::class,以及'Html'=>Collective\Html\HtmlFacade::class,用于别名。为什么在laravel文档中没有明确说明默认情况下不包括相当基本的组件。回答太棒了。Tnq对我来说很有用,这个混淆应该用:\app\config\app.php