我有以下从 Wolfram Alpha 获取结果的代码:
<?php
include 'WolframAlphaEngine.php';
$engine = new WolframAlphaEngine( 'API-KEY' );
$resp = $engine->getResults("2+2");
$pod = $resp->getPods();
$pod = $pod[1];
foreach($pod->getSubpods() as $subpod){
if($subpod->plaintext){
$plaintext = $subpod->plaintext;
break;
}
}
$result = substr($plaintext, 0,strlen($plaintext)-3);
echo $result;
?>
如果我搜索诸如“George W Bush”之类的文本,它会显示它应该显示的内容,但如果我搜索诸如 2+2 之类的等式,则它不会显示结果。有什么线索吗?