如何获取 solr 核心列表并将其插入到 php.ini 数组中。我想在 php 中创建一个数组变量来存储 solr 核心列表。我可以通过点击这个 URL 来获取我的内核列表:http://localhost:8983/solr/admin/cores下面显示了返回的部分结果:
{
"responseHeader":{
"status":0,
"QTime":74},
"initFailures":{},
"status":{
"Test17Jan":{
"name":"Test17Jan",
!-- Details removed --,
"Test8Feb":{
"name":"Test8Feb",
!-- Details removed --,
}
只需json_decode输出并获取返回状态键的 name 属性,如下所示:
$solr = json_decode($json);
foreach ($solr->status as $core) {
echo "Found core ". $core->name . PHP_EOL;
}
您可以在此处查看工作示例:https : //3v4l.org/VcBDV
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句