简体   繁体   中英

Accessing the base config of ZF2 application

I have a base config of my ZF2 application, which is in the following structure of my ZF2 application:

/frontend
        /config 
              /autoload -> (here I have config.php file - which is base config)
              /brand -> (here I have config files for my vhosts)

When I need things from my vhosts config I simply do like this:

$this->config()['SomethingGoesHere']

My question here is, when I'm located in my vhost (www.sitename1.com). I would like to access the base config within my vhost, how can I do that guys??

If you want to set different configuration for different virtual-hosts I would not recommend to do it like this. You can set more advanced configuration differently, for example by using environmental variables. You can read more on this here in the documentation chapter: Advanced Configuration Tricks .

The correct solution also totally depends on what variables you are setting and what you want to use them for and where you want to use them. If you provide more details on what you are trying to do (what is in your "base config" ?) it would be possible to give a more suitable answer for your needs.

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