无法让 zend 加载器仅在 wamp 下加载类

发布于 2024-08-09 04:04:49 字数 2462 浏览 7 评论 0原文

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

    //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(folder)
    -- 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

我错过了什么吗?

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();

my folder structure is:

  • zend_test(folder)
    -- testLoad.php (the above code lives there)
    -- library(folder)
    --- zend(doler)
    ---- (the zend libs and sub folders)

I get the following error messages:
attempt 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

attempt2

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

atempt3

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

Am i missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼泪也成诗 2024-08-16 04:04:49

您的包含路径应​​为:

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

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

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

Your include path should read:

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

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.

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

静待花开 2024-08-16 04:04:49

使用方法 3 并执行此操作以使其正常工作:

set_include_path('D:/wamp/www/zendTest/library/');   
require_once 'Zend/Loader/Autoloader.php';

Zend_Loader::loadClass('Zend_Date'); //or whatever zen class

used method 3 and did this to get it working:

set_include_path('D:/wamp/www/zendTest/library/');   
require_once 'Zend/Loader/Autoloader.php';

Zend_Loader::loadClass('Zend_Date'); //or whatever zen class
深海里的那抹蓝 2024-08-16 04:04:49

在 php.ini 中删除“;”在 include_Path 行之前并重新启动您的 wamp!

in php.ini remove ";" before line include_Path and restart your wamp!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文