[“警告”] => array(1){ [“ main”] => array(1){ [“*”] => string(67)”未识别的参数:Dixplaintext,ExectionFormat,ExSentences。”
First ...
$url='https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exsentences=5&explaintext=&exsectionformat=plain&format=json&pageids='.$item->id;
$x=json_decode(file_get_contents($url), true); ```
dump($x);
Second...
$url='https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&pithumbsize=200&format=json&pageids='.$item->id;
$x=json_decode(file_get_contents($url), true);
dump($x);
Third...
$url='https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exsentences=5&explaintext=&exsectionformat=plain&format=json&prop=pageimages&pithumbsize=200&pageids='.$item->id;
$x=json_decode(file_get_contents($url), true); ```
dump($x);
您遇到的问题是由于第三个呼叫中参数的不正确组合所致。 Wikipedia API返回错误,因为一起使用时某些参数不兼容。具体来说,
exsentences
explaintext
exsectionformat
要解决此问题,您应该通过分开图像检索并正确提取属性来调整调用。这是第三个呼叫的改进版本: