简体   繁体   English

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

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

Not sure if this is an Wordnik API issue or just a php error on my part. 不知道这是Wordnik API问题还是我个人的php错误。 Here is my current code: 这是我当前的代码:

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;

and here is the error I get: Fatal error: Call to undefined method WordApi::getRandomWord() 这是我得到的错误:致命错误:调用未定义的方法WordApi :: getRandomWord()

Any help is greatly appreciated. 任何帮助是极大的赞赏。 The error is happening on that line towards the bottom, just not sure why. 该错误发生在最底端的那条线上,只是不确定为什么。 Thank you. 谢谢。

getRandomWord() is defined in Word s Api (plural words). getRandomWord()在Word Api(复数单词)中定义。

  • You have: WordApi 您具有:WordApi
  • You need: Word s Api 您需要:Word Api

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

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