【问题标题】:zend: baseUrl view helper returns empty stringzend: baseUrl 视图助手返回空字符串
【发布时间】:2012-02-29 00:56:11
【问题描述】:
在我的网站上,当我在视图中调用 $this->baseUrl() 时,它返回一个空字符串。我希望它会返回,例如http://www.foobar.com/。需要手动设置base url吗?
在Zend_Application_Resource_Frontcontroller 的手册中 - 配置键,我刚刚找到了这个:
baseUrl:应用程序的显式基本 URL(通常自动检测)
任何想法为什么它没有自动检测到我?
【问题讨论】:
标签:
zend-framework
base-url
【解决方案1】:
baseUrl() 帮助器返回 Zend 应用程序的路径。
使用serverUrl() 帮助器作为主机名。
【解决方案2】:
您是否在 application.ini 中设置了 baseurl?
resources.frontController.baseUrl = "/subdir"
Manual