我无法从以下命名空间中的ebay-sdk加载GetMyMessagesRequestType类:
use DTSeBaySDKTradingServices;
use DTSebaySDKTradingTypes;
当我打电话给以下电话时:
use DTSeBaySDKShoppingServices;
use DTSebaySDKShoppingTypes;
ebayTime完美加载的有问题的类:
$service = new ServicesShoppingService();
// Create the request object.
$request = new TypesGeteBayTimeRequestType();
// 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: %sn", $response->Timestamp->format('H:i (GMT) on l jS Y'));
此代码有效。
但是我现在更改的代码如下所示:
$service = new ServicesTradingService([
'authToken'=> "",
'credentials' => [
'appId' => '',
'certId' => '',
'devId' => ''
],
'siteId'=>0
]);
$request = new TypesGetMyMessagesRequestType();
我收到以下错误消息:
Attempted to load class "GetMyMessagesRequestType" from namespace "DTSebaySDKTradingTypes".
Did you forget a "use" statement for "DTSeBaySDKTradingTypesGetMyMessagesRequestType"
任何想法这是我无法修复以完成项目的一件小事吗?
> 当您将 use 语句更改为 DTSebaySDKShoppingTypes
时,您尝试实例化的类在错误的命名空间中查找:DTSebaySDKShoppingTypesGetMyMessagesRequestType
不存在。
- 将
违规行从:
$request = new TypesGetMyMessagesRequestType();
进入(注意前导反斜杠(:
$request = new DTSeBaySDKTradingTypesGetMyMessagesRequestType();
或者将 use 语句添加到正确的命名空间:
use DTSeBaySDKTradingTypesGetMyMessagesRequestType; $request = new GetMyMessagesRequestType();