How to create a custom yaml config file in Symfony

前端 未结 6 567
面向向阳花
面向向阳花 2021-02-02 13:52

What I want to do is quite simple: store data in a custom config file that I want to read later on.

I created my file something.yml that I put in the global

6条回答
  •  我在风中等你
    2021-02-02 14:14

    Works in all application files:

    $configCache = sfApplicationConfiguration::getActive()->getConfigCache();
    $configCache->registerConfigHandler('config/something.yml', 'sfDefineEnvironmentConfigHandler', Array('prefix' => 'something_'));
    include $configCache->checkConfig('config/something.yml');
    

    Then you can use:

    sfConfig::get("something_foo");
    

提交回复
热议问题