[英]How to do you include a class in Symfony2?
I have read the Symfony documentation and I am still unsure of how to include a class. 我已经阅读了Symfony文档,我仍然不确定如何包含一个类。 I want to include a Google Analytics PHP class into Symfony, but not sure on the following:
我想将一个Google Analytics PHP类包含在Symfony中,但不确定如下:
Cheers 干杯
Adam 亚当
Use the app/autoload.php
file to configure your autoload mechanism. 使用
app/autoload.php
文件配置自动加载机制。
If your class doesn't follow PEAR style conventions or PSR-0 standards then you should plainly require it (as is the case with Swiftmailer in the same file) 如果您的类不遵循PEAR样式约定或PSR-0标准,那么您应该明确地要求它(与同一文件中的Swiftmailer一样)
If your class follows PEAR conventions then you should use registerPrefixes
method else, if your class follows PSR-0 standard (maybe not the case), you should use the registerNamespaces
method 如果你的类遵循PEAR约定,那么你应该使用
registerPrefixes
方法,如果你的类遵循PSR-0标准(可能不是这种情况),你应该使用registerNamespaces
方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.