Home> PHP Framework> Laravel> body text

Introduction to commonly used auxiliary functions in the Laravel framework

不言
Release: 2018-07-31 16:47:47
Original
2747 people have browsed it

Laravel frameworkThere are many very useful auxiliary functions. In the following article, I will introduce you to several commonly used auxiliary functions.

1.csrf token form

{{ csrf_token() }}
Copy after login

In this way, you can directly obtain the csrf_token maintained by Laravel itself. For example, it is usually used like this:

Copy after login

Or you can also directly get the hidden form of csrf token like this:

{!! csrf_field() !!}
Copy after login

This will directly output content similar to the following in html:

Copy after login

2. Generate method form

When using resource routing, there are some methods that the browser cannot support natively, such as DELETE, PATCH PUT, etc. At this time, you can use the code To generate method forms and simulate these requests:

{{ method_field('DELETE') }}
Copy after login

Generated HTML:

Copy after login

The above is the entire content of this article. For more laravel content, please pay attention to thelaravel framework introductory tutorial..

Recommended related articles:

The process of using Echo in the Laravel framework

The implementation of laravel framework in data statistical drawing

Related course recommendations:

The latest five Laravel video tutorial recommendations in 2017

The above is the detailed content of Introduction to commonly used auxiliary functions in the Laravel framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!