我有以下构造子
class MagentoConnector {
protected $_userData = [];
protected $_password, $_url, $_token, $_sku;
public function __construct($u, $p, $url) {
$this->_url = $url;
$this->_userData = ["username" => $u, "password" => $p];
$this->getTokenInit();
}
我需要添加什么才能获得产品类别ID值?
我正在休息以获取数据示例:
public function getProductName($sku) {
$ch = curl_init($this->_url . "V1/products/" . $sku);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $this->_token));
$result = curl_exec($ch);
$result = json_decode($result);
if (!isset($result->message)) {
return $result;
}