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

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

藏色散人
Release: 2021-09-23 09:06:39
forward
1807 people have browsed it

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

<code><br> "require": {
        "illuminate/html": "~5.0"
    },</code>
Copy after login

Update

<code><br>composer update</code>
Copy after login

After updating, open /config/app.php

inproviders Add

<code><br>'Illuminate\Html\HtmlServiceProvider',</code>
Copy after login

aliases below the array. Add

'Form'      => 'Illuminate\Html\FormFacade',
'HTML'      => 'Illuminate\Html\HtmlFacade'
Copy after login

below the array and it will be installed!

How to use

It used to be written like this

{{Form::open()}}

{{Form::close()}}
Copy after login

Now it’s like this

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

{!! Form::close() !!}
Copy after login

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

<code><br>Blade::setRawTags('{{', '}}');</code>
Copy after login

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

Reference completed Article 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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template