not - Clase no encontrada PHP
php use class not found (3)
Utilicé THIS twitter librabry y obtuve este error. ¿Alguien puede decir dónde me estoy equivocando?
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
?>
¿Estás seguro de que esta es la forma correcta? :
require_once("Abraham/TwitterOAuth/TwitterOAuth.php");
tu podrías intentar:
require_once("Abraham/autoload.php");
require_once("Abraham/TwitterOAuth/TwitterOAuth.php");
use Abraham/TwitterOAuth/TwitterOAuth;
TwitterOAuth usa la clase Config , pero no se carga automáticamente. Puede require esta clase o utilizar un cargador de clases. El mejor enfoque sería utilizar el composer para administrar sus dependencias (que viene con un cargador de clases).
¿Podría verificar su vendor/abraham/twitteroauth/src :
¿Hay una Config.php ?
Encontré este problema porque un .gitignore coloca en la parte superior del proyecto. Este contenía una línea config.php ... Lo cambié a /config.php para eliminar solo el archivo de configuración superior y habilitar el archivo en la biblioteca de abraham