Home > Article > PHP Framework > Introduction to commonly used auxiliary functions in the Laravel framework
Laravel framework There are many very useful auxiliary functions. In the following article, I will introduce you to several commonly used auxiliary functions.
{{ csrf_token() }}
In this way, you can directly obtain the csrf_token maintained by Laravel itself. For example, it is usually used like this:
<input name="_token" value="{{ csrf_token() }}" type="hidden" />
Or you can also directly get the hidden form of csrf token like this:
{!! csrf_field() !!}
This will directly output content similar to the following in html:
<input name="_token" value="3E0fFDOHQylQFdM1UQ8pjJyMuN8YP5erC6VxoHY8" type="hidden" />
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') }}
Generated HTML:
<input type="hidden" name="_method" value="DELETE">
The above is the entire content of this article. For more laravel content, please pay attention to the laravel 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!