在调用我的课程的主代码文件中,我有以下内容:
$api = new voip($_client_id,$_client_secret,$_username,$_password);
$api->login();
$api->getdomaininfo($company);
$api->logout();
类文件包含以下内容:
class voip
{
private $_client_id = '';
private $_client_secret = '';
private $_username = '';
private $_password = '';
protected $_access_token = '';
protected $_refresh_token = '';
protected $_api_url = '';
protected $_endpoint = '';
protected $_method = '';
public function __construct($_client_id_passed, $_client_secret_passed, $_username_passed, $_password_passed) {
$this->_client_id = $_client_id_passed;
$this->_client_secret = $_client_secret_passed;
$this->_username = $_username_passed;
$this->_password = $_password_passed;
}
最终结果似乎并不理想。我正确地将值传递到类文件中以便正确使用吗?我没有收到错误所以我只是想知道我是否正确使用__Construct函数。
我尝试用这样简单的事情进行调试:
public function getTok(){
return $this->_client_id;
}
但我没有从echo $api->getTok();