嘿,你自己不认识的朋友 Amaan,我正在为我的项目使用牛津词典 API,但我遇到了错误。这是我的代码
<?php
include_once 'dictionary.class.php';
$dictionary = new Dictionary("APP ID", "APP KEY", "en-gb");
$dictionary->newDictionaryRequest("Pizza");
$dictionary->setResult(0);
echo "<h1>Dictionary Class Results - ".$dictionary->word."</h1> - status: ".$dictionary->errors['status'];
echo "<b>Word:</b> ".$dictionary->word;
echo "<br><b>Definition:</b> ".$dictionary->getDefinition();
echo "<br><b>Short Definition:</b> ".$dictionary->getShortDefinition();
echo "<br><b>Example:</b> ".$dictionary->getExample(0);
echo "<br><b>Example 2:</b> ".$dictionary->getExample(1);
echo "<br><b>Lexical:</b> ".$dictionary->getLexical();
echo "<br><b>Phonetic:</b> ".$dictionary->getPhonetic();
echo "<br><b>Origin:</b> ".$dictionary->getOrigin();
echo "<br><b>Language:</b> ".$dictionary->API_LANG;
echo "<br><b>Audio:</b> <audio controls><source src='".$dictionary->getAudio()."' type='audio/mpeg'>Your browser does not support HTML audio</audio><br>";
echo "<br></br>Using result set: <b>".$dictionary->selected_result."</b>";
echo "<br></br>Total result sets available from request: <b>".$dictionary->num_returned_results."</b>";
?>
错误是这样的:-致命错误:未捕获的错误:调用此行上未定义的方法 Dictionary::setResult() :- $dictionary->setResult(0);
慕尼黑的夜晚无繁华