Home>Article>PHP Framework> Let’s talk about the use of Form and HTML in laravel5

Let’s talk about the use of Form and HTML in laravel5

藏色散人
藏色散人 forward
2021-09-22 16:08:30 1671browse

Recently I am using laravel 5 as an example. When making forms, I habitually use Form::open() It turns out that there is an error message, there is no such class,

Okay, I searched and found that in laravel 5, from and html are separately mentioned. Here is how to install and use it

Add to composer.json


"require": { "illuminate/html": "~5.0" },

Update


composer update

After updating, open /config/app.php

inprovidersAdd


'Illuminate\Html\HtmlServiceProvider',

aliasesbelow the array. Add

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

below the array and it will be installed!

How to use

It used to be written like this

{{Form::open()}} {{Form::close()}}

Now it’s like this

{!! Form::open() !!} {!! Form::close() !!}

The following paragraph is a reference to @久久的Article
If you are not comfortable using {!! HTML::script() !!}

Please go to the routing file routes.php and configure the following code


Blade::setRawTags('{{', '}}');

that is Can return to {{ HTML::script('js/jquery.js') }}

Reference completedArticle address http://wenda.golaravel.com/article/242

That’s basically it. For more usage methods, you can read the manual http://laravelcollective.com/

Recommended study: "laravel tutorial"


The above is the detailed content of Let’s talk about the use of Form and HTML in laravel5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete