无法让 zend 加载器仅在 wamp 下加载类
我是第一次尝试 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的包含路径应为:
当它尝试加载类 Zend_Date 时,它会在包含路径中查找名为 Zend 的文件夹,其中包含名为 Date.php 的文件。
您的所有 3 种方法都应该可以解决这个问题,我建议尝试 3。
Your include path should read:
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.
使用方法 3 并执行此操作以使其正常工作:
used method 3 and did this to get it working:
在 php.ini 中删除“;”在 include_Path 行之前并重新启动您的 wamp!
in php.ini remove ";" before line include_Path and restart your wamp!