简体   繁体   English

set_include_path不包含Zend框架

[英]set_include_path not include Zend framework

I have this statement: 我有这句话:

set_include_path('/sites/intranet/includes/Zend' . PATH_SEPARATOR . get_include_path());

but when I try to use the Acl library it seems that is not able to find the file; 但是当我尝试使用Acl库时,似乎无法找到该文件。

require_once 'Zend/Acl/Resource/Interface.php';

The path is really included in the path, I have printed it. 该路径确实包含在该路径中,我已将其打印出来。 Any idea? 任何想法?

If "Zend" is in your require_once instruction, you probably don't have to put it in your include_path too. 如果您的require_once指令中包含“ Zend”,则可能也不include_path其放入include_path

If your directories look like this : 如果您的目录如下所示:

/sites/intranet/includes/Zend/Acl/Resource/Interface.php

Your include_path should probably be : 您的include_path可能应该是:

set_include_path('/sites/intranet/includes' . PATH_SEPARATOR . get_include_path());

(Without the " Zend " part) (没有“ Zend ”部分)


As a sidenote : why are you not using the autoloader ? 附带说明:为什么不使用自动装带器

Maybe it is because you already has /Zend in the include path? 也许是因为在包含路径中已经有/Zend吗? So either do this 所以要么这样做

set_include_path('/sites/intranet/includes' . PATH_SEPARATOR . get_include_path());

or 要么

require_once 'Acl/Resource/Interface.php';

Due to the zend frameworks autoloader, the first one is recommended. 由于使用了zend frameworks autoloader,因此建议使用第一个。

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

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