我无法从ebay-sdk中加载GetMyMessagesRequestType类,它位于以下名称空间中:
use DTS\eBaySDK\Trading\Services;
use DTS\ebaySDK\Trading\Types;当我调用以下代码时:
use DTS\eBaySDK\Shopping\Services;
use DTS\ebaySDK\Shopping\Types;ebayTime完美加载的相关类:
$service = new Services\ShoppingService();
// Create the request object.
$request = new Types\GeteBayTimeRequestType();
// Send the request to the service operation.
$response = $service->geteBayTime($request);
// Output the result of calling the service operation.
printf("The official eBay time is: %s\n", $response->Timestamp->format('H:i (\G\M\T) \o\n l jS Y'));这段代码可以工作。
但是我现在修改的代码是这样的:
$service = new Services\TradingService([
'authToken'=> "",
'credentials' => [
'appId' => '',
'certId' => '',
'devId' => ''
],
'siteId'=>0
]);
$request = new Types\GetMyMessagesRequestType();我得到了以下错误消息:
Attempted to load class "GetMyMessagesRequestType" from namespace "DTS\ebaySDK\Trading\Types".
Did you forget a "use" statement for "DTS\eBaySDK\Trading\Types\GetMyMessagesRequestType"有没有什么想法,这是一个小事情,我无法修复完成项目?
发布于 2017-05-26 01:08:14
当您将use语句更改为DTS\ebaySDK\Shopping\Types时,您尝试实例化的类在错误的名称空间中查找:DTS\ebaySDK\Shopping\Types\GetMyMessagesRequestType不存在。
$request =新类型\GetMyMessagesRequestType();
转换为(注意前导反斜杠):
\DTS\eBaySDK\Trading\Types\GetMyMessagesRequestType();
use DTS\eBaySDK\Trading\Types\GetMyMessagesRequestType;GetMyMessagesRequestType(); =新$request
https://stackoverflow.com/questions/44185022
复制相似问题