繁体   English   中英

致命错误:使用Wordnik API调用未定义的方法

[英]Fatal error: Call to undefined method with Wordnik API

不知道这是Wordnik API问题还是我个人的php错误。 这是我当前的代码:

require('./wordnik/Swagger.php');
require('./wordnik/WordsApi.php');

$myAPIKey = '00144cdc1140c4192780f08c3f608399234240dcb560d3e4b';
$client = new APIClient($myAPIKey, 'http://api.wordnik.com/v4');

$wordApi = new WordApi($client);
$input = new WordObject();
$input->includePartOfSpeech='noun';
$input->excludePartOfSpeech='affix,article,connjunction,preposition,abbreviation,suffix';
$input->hasDictionaryDef='true';
$input->minCorpusCount='10000';
$input->maxCorpusCount='null';
$input->minDictionaryCount='20';
$input->maxDictionaryCount=null;
$input->minLength='4';
$input->maxLength='20';

$random_word = $wordApi->getRandomWord($input); //THIS IS THE ERROR LINE
print $random_word->text;

这是我得到的错误:致命错误:调用未定义的方法WordApi :: getRandomWord()

任何帮助是极大的赞赏。 该错误发生在最底端的那条线上,只是不确定为什么。 谢谢。

getRandomWord()在Word Api(复数单词)中定义。

  • 您具有:WordApi
  • 您需要:Word Api

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM