在 php 中加载 Zend Recaptcha 时出错


Error when loading Zend Recaptcha in php

我的应用程序在查找Zend库时遇到问题。我将 ZendFramework 放在一个单独的文件夹中(除了 public_html(,所以我使用自动加载器调用 Zend 类,如下所示:

$libreria='/home/conaprel/ZendFramework/library/';
set_include_path(get_include_path().PATH_SEPARATOR.$libreria);
require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance();

站点的文件夹结构是第一行代码中显示的内容。每当我需要可用的 Zend 类时,我都会包含这个文件。当我在本地服务器上运行它时,它工作正常,但现在它给了我错误:

Warning: include_once() [function.include-once]: Unable to access Zend/Service  /Recaptcha.php in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146
Warning: include_once(Zend/Service/Recaptcha.php) [function.include-once]: failed to open stream: No such file or directory in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'Zend/Service/Recaptcha.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/conaprel/ZendFramework/library') in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146

¿我能做什么?我已经检查了 Recaptcha.php 是否在"服务"文件夹中,它就在那里。

这看起来像是一个区分大小写的问题。正确的文件名是Zend/Service/ReCaptcha.php(注意大写字母"C"(,但您收到的错误表明它试图包含Zend/Service/Recaptcha.php(小写"C"(。我猜您在本地使用不区分大小写的文件系统,并且在生产中使用区分大小写。

只需更正您尝试实例化的类的大小写,它应该可以工作:

$captacha = new Zend_Service_ReCaptcha();