简体   繁体   中英

How to set base url in config.xml zend framework

How can I set base url in config.xml?. I'm using Zend Framework.

My index file has this following call:

$config = new Zend_Config_Xml($strDirectoryNameConfig . '/default/config.xml', 'config', true);

And this is my existing config.xml:

<server>
        <installationfolder>C:/xampp/htdocs/myapp/</installationfolder>
        <basefolder>/</basefolder>
        <session>
          <lifetime>86400</lifetime>
        </session>
</server>

It all depends where you want to use this config. I don't really see or understand where you like to use this Zend Config object.

The base url is something you have to set in the controller request object. The most general way to set the base url is like this

$fc = Zend_Controller_Front::getInstance();
$fc->setBaseUrl('/base');

If you provide more information about your config then you will have certainly other options and answers.

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