本文介绍了Composer/PSR - 如何自动加载功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何自动加载辅助函数(在任何类之外)?我可以在 composer.json
中指定某种应该首先加载的引导程序文件吗?
How can I autoload helper functions (outside of any class)? Can I specify in composer.json
some kind of bootstrap file that should be loaded first?
推荐答案
您可以自动加载特定文件 通过像这样编辑您的 composer.json
文件:
You can autoload specific files by editing your composer.json
file like this:
"autoload": {
"files": ["src/helpers.php"]
}
(感谢 Kint)
这篇关于Composer/PSR - 如何自动加载功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!