如何在Symfony中包含库

时间:2020-12-21 02:04:05

I am writing an application using Symfony. I have some reusable components that I don't want to put into the main Symfony modules; instead, they are in the lib directory.

我正在使用Symfony编写应用程序。我有一些可重用的组件,我不想放入主Symfony模块;相反,它们位于lib目录中。

What I want to know is, what is the best way to include this file? Can I include lib/foo/bar.php or do I need a full path, or is there something else I should do?

我想知道的是,包含此文件的最佳方法是什么?我可以包含lib / foo / bar.php,还是需要完整路径,还是我还应该做些什么?

2 个解决方案

#1


0  

I'm not an expert in Symfony, but these links should help You. Besides, because I am new to this forum, stackowerfolow lets me post just 1 link, so my second link will be explanation how to find it. ;)

我不是Symfony的专家,但这些链接应该对你有帮助。此外,因为我是这个论坛的新手,所以stackowerfolow只允许我发布一个链接,所以我的第二个链接将解释如何找到它。 ;)

  1. http://forum.symfony-project.org/index.php/m/92916/

    http://forum.symfony-project.org/index.php/m/92916/

  2. Google: The Definitive Guide to symfony 1.2 (should be still relevant) . There check the chapter 17 - "Extending Symfony" under the paragraph Plugins .

    谷歌:symfony 1.2的权威指南(应该仍然相关)。在插件段下查看第17章 - “扩展Symfony”。

#2


0  

you can use this to have the lib directory

你可以使用它来拥有lib目录

sfConfig::get('sf_lib_dir')

#1


0  

I'm not an expert in Symfony, but these links should help You. Besides, because I am new to this forum, stackowerfolow lets me post just 1 link, so my second link will be explanation how to find it. ;)

我不是Symfony的专家,但这些链接应该对你有帮助。此外,因为我是这个论坛的新手,所以stackowerfolow只允许我发布一个链接,所以我的第二个链接将解释如何找到它。 ;)

  1. http://forum.symfony-project.org/index.php/m/92916/

    http://forum.symfony-project.org/index.php/m/92916/

  2. Google: The Definitive Guide to symfony 1.2 (should be still relevant) . There check the chapter 17 - "Extending Symfony" under the paragraph Plugins .

    谷歌:symfony 1.2的权威指南(应该仍然相关)。在插件段下查看第17章 - “扩展Symfony”。

#2


0  

you can use this to have the lib directory

你可以使用它来拥有lib目录

sfConfig::get('sf_lib_dir')