Original address: http://blog.csdn.net/qq_38125058/article/details/76862151
Public functions, simply speaking, can be used directly anywhere. Two methods of implementation are briefly introduced.
First, create a new helpers.php file in the app directory, using the Customize public function.
Then you need to introduce this custom function,
The first method: the project root directory finds the Bootstrap folder,
As shown in the figure, open the autoload.php file and bring in the previously defined helpers.php.
The second kind: using composer to implement, the project root directory to find the Composer.json file, inside the introduction of custom function files, as shown in the figure
Then, execute the composer dump-autoload command under the project root directory.
Both of these methods can be used to create a common function, and can be directly called to this custom function anywhere, very convenient.