2015-02-07 4 views
2

THIS twitter librabry을 사용하고이 오류가 발생했습니다. 아무도 내가 잘못 가고 있다고 말할 수 있습니까?클래스를 찾을 수 없습니다 PHP

ERROR

Fatal error: Class 'Abraham\TwitterOAuth\Config' not found in D:\wamp\www\Abraham\TwitterOAuth\TwitterOAuth.php on line 17 

PHP

<?php 

require_once("Abraham/TwitterOAuth/TwitterOAuth.php"); //Path to twitteroauth library you downloaded in step 3 

//keys and tokens initialised 


function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) { 
    $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret); 
    return $connection; 
} 

$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret); 

$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets); 

echo json_encode($tweets); 
echo $tweets; //testing remove for production 
?> 
+0

이 질문을 볼 수 있습니다 : http://stackoverflow.com/questions/27745553/php-include-doesnt-work-for-twitteroauth-php-but-i-copy-and-paste-its-con-rq = 1 –

+0

@Esteban now 오류가 ' { "오류를 표시하고 있습니다. ": [{"message ":"당신을 인증 할 수 없습니다 ","code ": 32}]}' –

답변

5

당신이 올바른 방법이 있는지 있습니까? :

require_once("Abraham/TwitterOAuth/TwitterOAuth.php");

당신은 시도 할 수 :

require_once("Abraham/autoload.php"); 
require_once("Abraham/TwitterOAuth/TwitterOAuth.php"); 
use Abraham\TwitterOAuth\TwitterOAuth; 
+1

now '치명적인 오류 :'TwitterOAuth '클래스가 D : \ wamp \ www \ test.php의 36 행에 없습니다. ' –

+0

:-) 내 업데이트 된 답변을 시도하십시오 :-) – Alex

+0

그것은 덕분에 작동 –

0

TwitterOAuthConfig 클래스를 사용 -하지만이 자동으로로드되지 않습니다. 이 클래스는 require 일 수 있습니다. 또는 클래스 로더를 사용할 수 있습니다. 가장 좋은 방법은 composer을 사용하여 종속성을 관리하는 것입니다 (클래스 로더와 함께 제공됨).

Config.php 있습니까 :

+0

composer.json 파일이 있지만 사용 방법은 무엇입니까? @fateddy –

0

당신은 당신의 vendor\abraham\twitteroauth\src 확인할 수 있을까요?

이 문제는 프로젝트의 상단에 배치 된 .gitignore에 의해 발생합니다. 이것은 하나의 라인을 포함하고 있었다 config.php ... 나는 상위 설정 파일 만 제거하고 abraham의 라이브러리에서 파일을 활성화하기 위해 \config.php으로 바 꾸었습니다.

관련 문제