2012-02-29 51 views
0

时,当我在application.ini注册视图助手,我必须确保有APPLICATION_PATH/my/view/helper/path之间的空间。例如:路径问题登记在的application.ini(ZF 1.11)Zend的视图助手路径

; Note that there is not a space after APPLICATION_PATH. 
; This is the only way that I can get the helper path registered 
resources.view.helperPath.MyNamespace_Zend_View_Helper = APPLICATION_PATH'/my/view/helper/path' 

下将无法正常工作,因此抛出一个异常,指出“插件”没有被发现,这当然是“Zend的”为“说我无法找到路径上您的课“:

; Note the space directly after 'APPLICATION_PATH' - this will not work! 
resources.view.helperPath.MyNamespace_Zend_View_Helper = APPLICATION_PATH '/my/view/helper/path' 

为了让这个观点更加复杂一些,这个空间在所有其他情况下都起作用。例如:

; All three of the following examples have a space 
; after APPLICATION_PATH - and they work! 
bootstrap.path = APPLICATION_PATH "/Bootstrap.php" 
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 

回答

2

我注意到您在非工作示例中使用了单引号,而在您的工作示例中使用了双引号。

从评论上INI文件parse_ini_file()

常量没有扩展,如果他们用单引号括起来的字符串连接在一起,他们必须在双引号才使扩大常量。

简单的答案是,始终用双引号将您的ini文件值包裹起来。