简体   繁体   English

Zend Framework php.ini包含路径

[英]Zend Framework php.ini include path

so, I'm trying to get Zend Framework running, which has terribly vague instructions. 因此,我正在尝试使Zend Framework运行,其中包含非常模糊的说明。

It simply says, put the Zend folder in the directory, and add it to your include_path in php.ini . 简而言之,将Zend文件夹放在目录中,并将其添加到php.iniinclude_path中。

So, this is my include path: 因此,这是我的包含路径:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/tuner/public_html/market/Zend_1.12.3/library"

This is the section that should be including Zend, I have double checked the path: 这是应该包括Zend的部分,我仔细检查了路径:

/home/tuner/public_html/market/Zend_1.12.3/library

However, when I try to include a Zend class, I am still getting errors as though it is not included properly. 但是,当我尝试包含Zend类时,仍然会收到错误消息,好像没有正确包含它。

This is what is causing the error: 这是导致错误的原因:

$locale = new Zend_Locale('en_CA');
Zend_Registry::set('Zend_Locale', $locale);

What am I doing wrong when including the framework? 包含框架时我在做什么错?

You say you get an error when you try and include ZF class, but nowhere in the code you posted are you including a class (eg require_once 'Zend/Locale.php'; ). 您说尝试加入ZF类时遇到错误,但是您发布的代码中没有包含类(例如require_once 'Zend/Locale.php'; )。 If you want ZF classes to be automatically included when you try and use them (which is the recommended approach), you need to setup the autoloader . 如果希望在尝试使用ZF类时自动将它们包括在内(这是推荐的方法),则需要设置autoloader For ZF1, add the following somewhere above your existing code: 对于ZF1,在现有代码上方添加以下内容:

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

ZF classes will then be automatically required in on demand. 然后,将根据需要自动要求ZF类。

I don't know which docs you got the code snippet from, but you are mixing up ZF1 and ZF2. 我不知道您从哪个文档中获取了代码片段,但是您正在混淆ZF1和ZF2。 The part with Zend_Locale and Zend_Registry are ZF1 components, so this is clearly not going to work with the ZF2 library installed. 具有Zend_Locale和Zend_Registry的部分是ZF1组件,因此显然不能与已安装的ZF2库一起使用。

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

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