Ich arbeite an einer Art von einer Bibliothek, die Requests
Bibliothek verwendet. Ich bekomme einen Fehler im Titel. Ich tue folgendes:Klasse kann nicht redeclariert Anfragen
function __autoload($class_name) {
include 'vendor/rmccue/requests/library/Requests.php';
$class_file = $class_name.'.php';
print $class_file;
if(file_exists($class_file)) {
include $class_file;
} else {
throw new Exception("Unable to load $class_name.<br>.<br>.<br>");
}
}
$session = new Session($instanceID,$profileID,$routerID,$api_endpoint,$headers);
$session->createSession();
Seit Requests
wird in mehreren Klassen verwendet werden, ich will einmal laden. Wie kann ich es tun?
Session.php
class Session
{
private $instanceID = null;
private $profileID = null;
private $routerID = null;
private $apiEndpoint = null;
private $headers = null;
public function __construct($instance_id,$profile_id,$router_id,$api_endpoint,$headers)
{
$this->instanceID = $instance_id;
$this->profileID = $profile_id;
$this->routerID = $router_id;
$this->apiEndpoint = $api_endpoint;
$this->headers = $headers;
}
public function createSession()
{
$create_session_url = $this->apiEndpoint.'createSession?{"accountID":"39BB2F17-89D6-2093-B133-76C21D513EDF"}';
$create_session_url = 'https://api.xx.cc/api/index.php/smartcall/createSession?{%22accountID%22:%2239BB2F17-89D6-2093-B133-76C21D513EDF%22}';
$request = \Requests::get($create_session_url, $this->headers);
var_dump($request->body);
}
}
Update # 1 dies nun tun Ich sagte ich: Class Session nicht gefunden:
include 'vendor/rmccue/requests/library/Requests.php';
\Requests::register_autoloader();
function __autoload($class_name) {
$class_file = $class_name.'.php';
if ($class_file != 'Requests.php') {
print $class_file;
if(file_exists($class_file)) {
include_once $class_file;
} else {
throw new Exception("Unable to load $class_name.<br>.<br>.<br>");
}
}
}
$session = new Session($instanceID,$profileID,$routerID,$api_endpoint,$headers);
$session->createSession();
Der Fehler tritt becuase 'Request.php' ist bereits enthalten oder woanders erforderlich, überprüfen Sie zuvor Dateien enthalten – Fabio
Nein es sonst nirgendwo ist, gibt es keine Neudeklaration der Antrag Klasse ist und der Code, den ich hier gab, ist die einzige Berufung Klasse – Volatil3
Dies ist, was der Fehler sagt – Fabio