类“Zend_Search_Lucene”未找到

发布于 2024-11-16 15:22:02 字数 375 浏览 6 评论 0原文

作为 PHP 调用方面 Zend 框架的大初学者,我可以将其包含在 Netbeans IDE 中。现在我正在尝试使用它来使用 Zend_Lucene 实现 Lucene 索引器和搜索器,我遵循了官方网站的入门,不幸的是他们只用了几句话就解释了整个事情。不管怎样,我复制粘贴了这个 $index = Zend_Search_Lucene::create($indexPath);,但是我在这一行收到一条消息: Fatal error: Class 'Zend_Search_Lucene' not found in C:\wamp \www\witswork\luceneTry.php 意味着该功能仍然未知,也许需要将一些文件复制到我的项目文件夹中,但实际上我现在已经没有想法了。 接受我的问候, 丹尼90。

A big beginner of Zend-framework on PHP calls, I could include it on Netbeans IDE. Now I'm trying to use it to achieve a Lucene indexer and searcher using Zend_Lucene, I followed the getting started of the official site, unfortunately they explain the whole thing with just few words. Anyway, I copied pasted this $index = Zend_Search_Lucene::create($indexPath);, but I got a message onto this line saying: Fatal error: Class 'Zend_Search_Lucene' not found in C:\wamp\www\witswork\luceneTry.php
means that the function still unknown, maybe, some files need to be copied on my project folder but really I'm running out of ideas right now.
Accept my regards,
dany90.

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

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

发布评论

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

评论(1

绝情姑娘 2024-11-23 15:22:02

您需要首先加载包含 Zend_Search_Lucene 类的 php 文件。一种选择是加载 your/path/to/library/Zend/Search/Lucene.php:

require_once 'my/path/to/library/Zend/Search/Lucene.php';
$index = new Zend_Search_Lucene::create($indexPath);

该类加载其所有依赖项,因此您无需担心这一点。

另一种选择是使用 Zend 的自动加载器,Zend_Loader_Autoloader。这个类是一个单例,当你第一次检索它时,它会向 spl_autoload() 注册自己:

$autoloader = Zend_Loader_Autoloader::getInstance();
$index      = new Zend_Search_Lucene::create($indexPath);

自动加载器加载后,你就可以使用 Zend_Search_Lucene 而无需 >require_once() 调用。在 Zend Framework 的手册中,您可以可以找到有关自动加载器的更多信息。

You need to load the php file which contains the Zend_Search_Lucene class first. One option is to load your/path/to/library/Zend/Search/Lucene.php:

require_once 'my/path/to/library/Zend/Search/Lucene.php';
$index = new Zend_Search_Lucene::create($indexPath);

This class loads all its dependencies, so you don't need to worry about that.

Another option is to use the autoloader of Zend, Zend_Loader_Autoloader. This class is a singleton and registers itself with spl_autoload() when you retrieve it for the first time:

$autoloader = Zend_Loader_Autoloader::getInstance();
$index      = new Zend_Search_Lucene::create($indexPath);

After the autoloader is loaded, you just can use Zend_Search_Lucene without the require_once() call. In the manual of Zend Framework you can find more information about the autoloader.

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