我刚开始学习PHP而且我正在尝试使用Indico文本情感API,但它无法正常工作。
<?php
require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = '9cdcfd0a.......';
IndicoIo::sentiment("I love writing code!");
?>
显示以下错误:
> Warning: array_key_exists() expects parameter 2 to be array, null
given in C:\xampp\htdocs\indico api\IndicoIo\IndicoIo.php on line 298
>Warning: array_key_exists() expects parameter 2 to be array, null
given in C:\xampp\htdocs\indico api\IndicoIo\IndicoIo.php on line 300
> Fatal error: Uncaught Exception in C:\xampp\htdocs\indico
api\IndicoIo\IndicoIo.php:303 Stack trace: #0 C:\xampp\htdocs\indico> api\IndicoIo\IndicoIo.php(64): IndicoIo\IndicoIo::_callService('I love
writing ...', 'sentiment', 'predict', Array) #1 C:\xampp\htdocs\indico api\text.php(7): IndicoIo\IndicoIo::sentiment('I love writing ...') #2 {main} thrown in C:\xampp\htdocs\indico api\IndicoIo\IndicoIo.php on
line 303