将另一个类的数据插入CURL

时间:2018-05-12 20:59:01

标签: php class curl header

我有两节课; APIKey和Curl。我不能把API Key放在CURL类的标题行中。

我正在尝试将此API密钥添加到Curl类。

$this->apiValue

我已经尝试过这些例子并试图尝试但我没有成功。

我收到内部500错误。可能是什么问题?

代码:

class APIkey
 {
      public $apiValue;

      public function __construct(string $apiValue)
      {
          $this->apiValue = $apiValue;
      }

      public function getApiAna()
      {
                echo $this->apiValue;
      }
}

结果:

  

内部500错误

1 个答案:

答案 0 :(得分:0)

您正在尝试实现继承但未按预期使用。 同时将非静态方法称为静态 使用方式如下:

$c = new Curl('8fbb80d7f378f2276246388093439422');
$c->lists($json, $http_status);