我使用tophatter php库并发现错误Class' ProductApi'未找到 ?有人对此有任何想法吗? 我尝试了很多次同样的事情,但不幸的是,这个问题一次又一次地发生,我无法在tophatter上传产品请帮忙。
以下是代码:
<?php
require('TophatterMerchant/TophatterMerchantApi.php');
require('TophatterMerchant/ProductApi.php');
require('TophatterMerchant/VariationApi.php');
require('TophatterMerchant/OrderApi.php');
require('TophatterMerchant/MetadataApi.php');
require('TophatterMerchant/Model/Schema.php');
require('TophatterMerchant/Exception/BadRequestException.php');
require('TophatterMerchant/Model/Product.php');
require('TophatterMerchant/Model/Variation.php');
require('TophatterMerchant/Model/Order.php');
require('TophatterMerchant/Model/Metadata.php');
require('TophatterMerchant/Exception/UnauthorizedException.php');
require('TophatterMerchant/Exception/BadContentTypeException.php');
require('TophatterMerchant/Exception/NotFoundException.php');
use TophatterMerchant\TophatterMerchantApi;
use TophatterMerchant\VariationApi;
use TophatterMerchant\OrderApi;
use TophatterMerchant\MetadataApi;
use TophatterMerchant\Exception\BadContentTypeException;
use TophatterMerchant\Exception\BadRequestException;
use TophatterMerchant\Exception\NotFoundException;
use TophatterMerchant\Exception\ServerErrorException;
use TophatterMerchant\Exception\UnauthorizedException;
use TophatterMerchant\Exception\ConnectionException;
TophatterMerchantApi::setAccessToken('xxxxxxxxxxxxxxxxxxx');
$product = array(
//product details
);
$json_response =ProductApi::create($args);
答案 0 :(得分:0)
您只需添加一行
即可use TophatterMerchant\ProductApi;
通过此行,您可以轻松上传产品