Я пытаюсь использовать остальные API, я использую следующий код, но когда я проверяю почтальон, то не работает для меня, показывая мне следующую ошибку
" Fatal error</b>: Uncaught Error: Call to undefined method Api::() "
в почтальоне я использовал - http://localhost/wordbells/Api/Register
Вот мой код
<?php
include 'dp.php';
Class Api extends Db{
public $response;
public $_url = "http://localhost/wordbells/";
public function __construct() {
parent::__construct();
$this->response = new stdClass();
}
function Register(){
echo "any text here";
}
}
$url = isset($_POST['action']) ? $_POST['action'] : '' ;
unset($_POST['action']);
$api = new Api();
//@checking if the method exists or not
if(method_exists($api, $url)):
$api->$url();
else:
$api->response->status = false;
$api->response->message = 'Wrong Url';
die(json_encode($api->response));
endif;