Home> PHP Framework> Laravel> body text

laravel adds custom helper function

藏色散人
Release: 2020-03-13 08:56:34
Original
2345 people have browsed it

laravel adds custom helper function

You can see that laravel has many useful functions built in.

The characteristic of these functions is that they do not depend on a specific class

So how do we add a custom globally available helper function?

Recommended:laravel tutorial

There are three steps in total

The first step

Create a new file in the app directory

helpers.php
Copy after login

(In fact, it doesn’t matter where it is or what its name is, the key lies in the next step)

Second step

Add

laravel adds custom helper function

in composer.json Step 3

composer dumpautoload
Copy after login

Ok

The principle is to load automatically. Please search for details.

Related recommendations, PHP video tutorial learning address://m.sbmmt.com/course/list/29/type/2.html

The above is the detailed content of laravel adds custom helper function. 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!