无法让 zend 加载器仅在 wamp 下加载类 [英] Cant get the zend loader to load classes only under wamp

查看:18
本文介绍了无法让 zend 加载器仅在 wamp 下加载类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次尝试 zend 框架类.我现在有兴趣使用一些单独的类.在此处和博客中阅读文档和其他一些问题,我尝试了三种加载类的方法

I'm trying out the zend framework classes for the first time. I am interested in using some of the individual classes for now. Reading the documentation and some other q's here and in blogs I've tried three ways to load the classes

    //attempt 1 - using zend loader
require_once('library\Zend\Loader.php');
Zend_Loader::loadClass('Zend_Date');

    //attempt 2 - direct class load
require_once('library\Zend\Date.php');

    // attempt 3 - auto load
set_include_path('D:\wamp\www\testPages\zend_test\library\Zend' . PATH_SEPARATOR . get_include_path());
require_once 'Loader\Autoloader.php';


$date = new Zend_Date();

// Output of the desired date
print $date->get();

我的文件夹结构是:

  • zend_test(文件夹)
    -- testLoad.php(上面的代码在那里)
    -- 库(文件夹)
    --- Zend(doler)
    ----(zend 库和子文件夹)

我收到以下错误消息:尝试 1

Warning: include(Zend\Date.php) [function.include]: failed to open stream: No such file or directory in D:\wamp\www\testPages\zend_test\library\Zend\Loader.php on line 83

Warning: include() [function.include]: Failed opening 'Zend\Date.php' for inclusion (include_path='.;C:\php5\pear') in D:\wamp\www\testPages\zend_test\library\Zend\Loader.php on line 83

Warning: require_once(Zend/Exception.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\testPages\zend_test\library\Zend\Loader.php on line 87

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Exception.php' (include_path='.;C:\php5\pear') in D:\wamp\www\testPages\zend_test\library\Zend\Loader.php on line 87

尝试2

Warning: require_once(Zend/Date/DateObject.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\testPages\zend_test\library\Zend\Date.php on line 25

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Date/DateObject.php' (include_path='.;C:\php5\pear') in D:\wamp\www\testPages\zend_test\library\Zend\Date.php on line 25

尝试3

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\testPages\zend_test\library\Zend\Loader\Autoloader.php on line 24
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='D:\wamp\www\testPages\zend_test\library\Zend;.;C:\php5\pear') in D:\wamp\www\testPages\zend_test\library\Zend\Loader\Autoloader.php on line 24

我错过了什么吗?

推荐答案

你的包含路径应​​该是:

Your include path should read:

include_path='D:\wamp\www\testPages\zend_test\library;.;C:\php5\pear

当它尝试加载类 Zend_Date 时,它​​会在包含路径中查找名为 Zend 的文件夹,其中包含名为 Date.php 的文件.

When it tries to load the class Zend_Date it looks for a folder called Zend in the include path, with a file called Date.php in it.

您的所有 3 种方法都应该可以解决此问题,我建议尝试 3.

All 3 of your methods should work with this corrected, and I recommend attempt 3.

这篇关于无法让 zend 加载器仅在 wamp 下加载类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆