0

错误是:

解析错误:语法错误,第 9 行 /Applications/MAMP/htdocs/wp-content/plugins/plugin-name/includes/display-functions.php 中的意外“使用”(T_USE)

require_once "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;    //<--this is line 9 where the error occurs

$consumerkey = '***************';
$consumersecret = '*********************************************';
$accesstoken = '*********************************************';
$accesstokensecret = '******************************';

$connection = new TwitterOAuth($consumerkey, $consumersecret ,$accesstoken, $accesstokensecret);
$statues = $connection->get("statuses/home_timeline", array("count" => 25, "exclude_replies" => true));

任何帮助将不胜感激。

4

1 回答 1

0

我刚刚偶然发现了这一点。

我无法弄清楚为什么它不起作用,但管理了一个简单的解决方法。

这是工作代码:

require_once "twitteroauth/autoload.php";
//use Abraham\TwitterOAuth\TwitterOAuth;    //<--this is line 9 where the error occurs

$consumerkey = '***************';
$consumersecret = '*********************************************';
$accesstoken = '*********************************************';
$accesstokensecret = '******************************';

$connection = new Abraham\TwitterOAuth\TwitterOAuth($consumerkey, $consumersecret ,$accesstoken, $accesstokensecret);

希望它对任何人都有帮助。

于 2019-05-08T07:37:03.277 回答