PHP 8.5.0 Alpha 4 available for testing

Voting

: max(three, five)?
(Example: nine)

The Note You're Voting On

edwardtam at et-it dot net
9 years ago
i found that 'php' is also supported.

<?php
$solr_server
= array
(
'hostname' => $solr_hostname,
'port' => $solr_port,
'path' => $solr_path,
);
$solr_client = new SolrClient($solr_server);

$solr_response_writer = 'php'; // "wt"
$solr_client->setResponseWriter($solr_response_writer);

$solr_response = new SolrObject();

$solr_query = new SolrQuery();
$solr_query->setQuery($solr_query_string); // "q"

try {
$query_response = $solr_client->query($solr_query);
$solr_response = $query_response->getResponse();
return
'';
} catch (
Exception $e) {
return (
$e);
}
?>

php_error.log keeps on saying:

[12-Aug-2015 12:34:56 Asia/Hong_Kong] PHP Warning: SolrClient::setResponseWriter(): Unsupported response writer php. This value will be ignored in C:\www\...\solr.php on line 21

but the returned data is good as expected:

<?php
$html
.= '<table cellSpacing="1" cellPadding="1" border="1">';
$html .= '<tr>';
$html .= '<td>id</td>';
$html .= '<td>title</td>';
$html .= '<td>score</td>';
$html .= '</tr>';

for (
$i_solr = 0; $i_solr <= ($solr_rows - 1); $i_solr++) {
$html .= '<tr>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['id'] . '</td>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['title'][0] . '</td>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['score'] . '</td>';
$html .= '</tr>';
}
$html .= '</table>';
echo
$html;
?>

<< Back to user notes page

To Top