Kann mir bitte jemand helfen. Ich erhalte einen schwerwiegenden Fehler beim folgenden PHP-Skript.Ermitteln eines schwerwiegenden Fehlers beim Aufruf der Methode "unidentified" Pass :: _ createpass()
Ich erhalte eine Fehlermeldung "unidentified method Pass :: _ createpass()" whick bezieht sich auf die vorletzte Zeile des folgenden Codes.
<?php
$engine = Pass::start('xxxxxxxxxxxxxxxx');
$pass = $engine->createPassFromTemplate(xxxxxxxxxxxxxx);
$engine->redirectToPass($pass);
if (!function_exists('curl_init')) {
throw new Exception('Pass needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new Exception('Pass needs the JSON PHP extension.');
}
$engine = Pass::start($appKey);
$values = array(
'first' => 'John',
'last' => 'Platinum',
);
$images = array(
'thumbnail' => 'image1.jpg'
);
$pass = $engine->createPassFromTemplate(5688667418918912, $values, $images);
$passData = $engine->downloadPass($pass);
$engine->redirectToPass($pass);
class Pass
{
private $_appKey = null;
private $_endpoint = 'https://pass.center/api/v1';
private $_debug = false;
private static $_instance = null;
private static $_imageTypes = array('icon', 'logo', 'strip', 'thumbnail', 'background', 'footer');
const VERSION = '0.5';
const USER_AGENT = 'PassSDK-PHP/0.5';
public function __construct($appKey = null, $endpoint = null, $debug = false)
{
if (is_null($appKey)) {
throw new Exception('App Key required');
}
$this->_appKey = $appKey;
if ($endpoint !== null) {
$this->_endpoint = $endpoint;
}
$this->_debug = $debug;
}
public static function start($appKey = null, $endpoint = null, $debug = false)
{
if (self::$_instance == null) {
self::$_instance = new self($appKey, $endpoint, $debug);
}
return self::$_instance;
}
public function createPassFromTemplate($templateId, $values = array(), $images = array())
{
$resource = sprintf("https://xxxxxxx/api/v1/templates/names/Test/pass", $templateId);
return $this->_createPass($resource, $values, $images);
}
}
Ich hoffe, jemand kann mir helfen, da ich nicht mit Funktionen PHP vertraut bin.
Dank Alle
Rob
'$ this -> _ createPass' Sie versuchen, Funktion' _createPass' in der Klasse 'Pass' zu nennen, aber du hast nicht die Funktion definiert in Ihrer Klasse – nospor
Da Ihre 'Pass' Klasse keine Methode namens' _createPass() 'hat, ist das nicht wirklich überraschend –