简体   繁体   中英

Where should I add my internal classes file in symfony2?

我正在将一个旧项目移植到symfony2以便开始学习该框架,但我无法实现如何正确添加我在PHP文件中拥有的一些辅助函数的方法。

Services . Wrap those function in a class (like Helper ), define the class as a service and then inject it where needed (controller or another service, or even into a cli command).

The namespace (thus the path, as you tagged the question with psr-0) is up to you.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM