如何在config.xml zend框架中设置基本URL

时间:2012-02-16 12:31:01

标签: zend-framework configuration config

如何在config.xml中设置基本URL?我正在使用Zend Framework。

我的索引文件有以下调用:

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

这是我现有的config.xml:

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

1 个答案:

答案 0 :(得分:1)

这完全取决于您要使用此配置的位置。我真的没有看到或理解你喜欢使用这个Zend Config对象的位置。

您必须在控制器请求对象中设置基本URL。设置基本网址的最常用方法是这样的

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

如果您提供有关配置的更多信息,那么您肯定会有其他选项和答案。