Home >PHP Framework >Laravel >laravel adds custom helper function

laravel adds custom helper function

藏色散人
藏色散人Original
2020-03-13 08:56:342470browse

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

(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

Ok

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

Related recommendations, PHP video tutorial learning address: https://www.php.cn/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!

Statement:
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