问题描述
我正在尝试将帖子发布到我的 Twitter 帐户.因此,我正在尝试著名的 https://github.com/abraham/twitteroauth
脚本.
I am trying to tweet posts to my twitter account.Therefore I am trying famous https://github.com/abraham/twitteroauth
script.
我的文件夹结构是:
www.mysite.com/twitterbot/
|-- twitteroauth (folder)
| |-- Util (folder)
| | `-- JsonDecoder.php
| |-- autoload.php
| |-- Config.php
| |-- Consumer.php
| |-- HmacSha1.php
| |-- Request.php
| |-- Response.php
| |-- SignatureMethod.php
| |-- Token.php
| |-- TwitterOAuth.php
| |-- TwitterOAuthException.php
| `-- Util.php
`-- index.php
还有我的index.php
<?php
require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
$consumerKey = "myconsumerkey"; // Consumer Key
$consumerSecret = "mycinsumersecret"; // Consumer Secret
$accessToken = "myaccesstoken"; // Access Token
$accessTokenSecret = "my access token secret"; // Access Token Secret
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$statues = $connection->post("statuses/update", array("status" => "I'm posting a tweet!"));
?>
当我访问 www.mysite.com/twitterbot/
时显示 **Fatal error**: Class 'Abraham\TwitterOAuth\TwitterOAuth' not found in mysitecom/twitterbot/index.php 第 8 行
第 8 行是 $statues = $connection->post("statuses/update", array("status" => "I'm post a tweet!"));
我做错了什么?我该如何解决这个问题?
What I am doing wrong?how can I fix this?
推荐答案
所以你的文件夹结构真的不应该像原来那样改变(忽略重复的 mysitecom 文件夹)
So your folder structure should really not change from the original like so (disregard the duplicate mysitecom folder)
这篇关于致命错误:在子文件夹中找不到类 'Abraham\TwitterOAuth\TwitterOAuth'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!