I have functions file.
In this file include many functions
and i want to use them in my controllers What am i do?
I use laravel 5.1
Let's say your function file is additional_functions.php
, put it inside some folder like app/my_functions
.
Then you need to add that file to autoload, you'll have to open composer.json and add such code:
"autoload": {
...
"files": [
"app/my_functions/additional_functions.php"
]
...
}
After you're done, you only need to run composer dump-autoload
to reload the autoload file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.