我正处于WAMP服务器上的Apache Solr配置阶段。 当我在WAMP服务器上运行此代码时,它显示PHP致命错误,
致命错误:第54行的C:\ wamp \ www \ Search Enginge \ home.php中找不到“SolrClient”类
Home.php
<?php
include "bootstrap.php";
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
$query = new SolrQuery();
$query->setQuery("*.*");
$query->addField('id')->addField('author')->addField('content_type')->addField('user')->addField('file_type');
$query->setFacet(true);
$query->addFacetField('content_type')->addFacetField('file_type');
$query_response = $client->query($query);
$response = $query_response->getResponse();
$array=(array)$response['facet_counts']['facet_fields']['file_type'];
?>
bootstrap.php中
<?php
/* Domain name of the Solr server */
define('SOLR_SERVER_HOSTNAME', 'localhost');
/* Whether or not to run in secure mode */
define('SOLR_SECURE', true);
/* HTTP Port to connection */
define('SOLR_SERVER_PORT', ((SOLR_SECURE) ? 8990 : 8990));
/* HTTP Basic Authentication Username */
define('SOLR_SERVER_USERNAME', 'admin');
/* HTTP Basic Authentication pasword */
define('SOLR_SERVER_PASSWORD', '');
/* HTTP connection timeout */
/* This is maximum time in seconds allowed for the http data transfer operation. Default value is 30 seconds */
define('SOLR_SERVER_TIMEOUT', 10);
/* File name to a PEM-formatted private key + private certificate (concatenated in that order) */
define('SOLR_SSL_CERT', 'certs/combo.pem');
/* File name to a PEM-formatted private certificate only */
define('SOLR_SSL_CERT_ONLY', 'certs/solr.crt');
/* File name to a PEM-formatted private key */
define('SOLR_SSL_KEY', 'certs/solr.key');
/* Password for PEM-formatted private key file */
define('SOLR_SSL_KEYPASSWORD', 'StrongAndSecurePassword');
/* Name of file holding one or more CA certificates to verify peer with*/
define('SOLR_SSL_CAINFO', 'certs/cacert.crt');
/* Name of directory holding multiple CA certificates to verify peer with */
define('SOLR_SSL_CAPATH', 'certs/');
?>