私はOOPが初めてなので、何かが足りないかもしれません。コードを少し調べましたが、結果が返されない理由がわかりません。クラスは以下のとおりです (私の API キーは正しいです - 人々が私のアカウントにアクセスできないように変更しただけです):
<?php
class Inputs {
private $URL;
private $Key;
private $Action;
public function __construct() {
$this->URL = 'https://inputs.io/api?key=' . $this->Key;
$this->Key = '123';
}
public function Methods($Action) {
if($this->Action == 'getbalance') {
return file_get_contents($this->URL . '&action=getbalance');
}
}
}
$Inputs = new Inputs;
print_r($Inputs->Methods('getbalance'));
API のドキュメントはこちら: https://inputs.io/api
URL にアクセスしたくない場合は、次の画像をご覧ください: http://puu.sh/4C5uW.png
ありがとう。