Accessing Files Relative to Bundle in Symfony2

后端 未结 4 1692
说谎
说谎 2020-11-30 18:13

In a Symfony2 app\'s routing configuration, I can refer to a file like this:

somepage:
    prefix: someprefix
    resource: \"@SomeBundle/Resources/config/co         


        
4条回答
  •  没有蜡笔的小新
    2020-11-30 18:58

    If you want to do that in a file located in src/.../SomeBundle/... you can use __DIR__ to get the full path of the current file. Then append your Resources/... path to that like

    $foo = __DIR__.'/Resources/config/config.yml';
    

提交回复
热议问题