简体   繁体   English

Zend:如何防止includePath中的双库?

[英]Zend: How to prevent double library in includePath?

Zend Quick Start Zend快速入门

public/index.php public / index.php

set_include_path(implode(PATH_SEPARATOR, array(
    dirname(dirname(__FILE__)) . '/library',
    get_include_path(),
)));

configs/application.ini configs / application.ini

includePaths.library = APPLICATION_PATH "/../library"

As a result 结果是

print get_include_path();
// prints %localpath%/application/../library:%localpath%/library

if drop "includePaths.library" from ini, ./zf (Zend_Tool) fails. 如果从ini中删除“ includePaths.library”,则./zf(Zend_Tool)失败。 If drop in index.php, bootstraping fails. 如果将index.php放入,引导将失败。

How to correctly prevent this duplicate? 如何正确防止重复?

I think you're right that the include path shouldn't be in application.ini as well, so I'd remove that. 我认为您是对的,include路径也不应在application.ini中,因此我将其删除。 Then to get Zend Tool working, I think you have two options: 然后,要使Zend Tool正常工作,我认为您有两种选择:

  1. Change your setup to be like the top answer in this question: Zend tool include path (which will help ZF find the include path). 将您的设置更改为该问题的最高答案: Zend工具包含路径 (这将帮助ZF查找包含路径)。 ZF's auto discovery was changed somewhere along the way though so I'm not sure if this approach will still work. ZF的自动发现在整个过程中都发生了变化,因此我不确定这种方法是否仍然有效。

  2. Alternatively there is an environment variable you can set to give Zend Tool the library location, details here: http://framework.zend.com/manual/1.12/en/zend.tool.framework.clitool.html (see the section titled "Other Setup Considerations"). 另外,您可以设置一个环境变量来为Zend Tool提供库位置,详细信息请参见: http : //framework.zend.com/manual/1.12/en/zend.tool.framework.clitool.html (请参见标题为“ “其他设置注意事项”)。

Personally I would just skip Zend Tool - I don't think it really makes things easier. 就我个人而言,我只是跳过Zend Tool-我不认为这真的使事情变得容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM