Google AdWords API PHP ReportDefinitionService 选择器
Google AdWords API PHP ReportDefinitionService Selector
我遇到了 ReportDefinitionService 的选择器 class 问题。 class 不存在。这是来自官方 google 示例的代码:
// Load the service, so that the required classes are available.
$user->LoadService('ReportDefinitionService', 'v201603');
// Optional: Set clientCustomerId to get reports of your child accounts
// $user->SetClientCustomerId('INSERT_CLIENT_CUSTOMER_ID_HERE');
// Create selector.
$selector = new Selector(); //The error happens here. Class 'Selector' isn't found
$selector->fields = array('CampaignId', 'AdGroupId', 'Id', 'Criteria','CriteriaType', 'Impressions', 'Clicks', 'Cost');
文件 /vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/v201603/ReportDefinitionService.php 中没有选择器定义,而此 class 在许多其他服务中定义。
我正在尝试让它在 Laravel 5.1
上运行
如果我将目录 vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603 添加到我的 classmap:
,错误就会消失
"autoload": {
"classmap": [
...
"vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603"
],
...
但我不确定我是否能做到。知道出了什么问题吗?
您所做的是正确的,符合 this section 中的预期。
需要手动 classmap,因为在 src/Google/Api/Ads/AdWords/Util
.
下的每个版本目录中都声明了一些具有相同名称的 classes
在 DownloadCriteriaReport 示例中,我认为您已经将其中的一些部分带到这里,ReportUtils.php 文件包含在第 29 行。
在 ReportUtils 中,class 选择器在包含 ReportClasses 文件时声明。
希望对您有所帮助。
萨尼特,
AdWords API 团队
我遇到了 ReportDefinitionService 的选择器 class 问题。 class 不存在。这是来自官方 google 示例的代码:
// Load the service, so that the required classes are available.
$user->LoadService('ReportDefinitionService', 'v201603');
// Optional: Set clientCustomerId to get reports of your child accounts
// $user->SetClientCustomerId('INSERT_CLIENT_CUSTOMER_ID_HERE');
// Create selector.
$selector = new Selector(); //The error happens here. Class 'Selector' isn't found
$selector->fields = array('CampaignId', 'AdGroupId', 'Id', 'Criteria','CriteriaType', 'Impressions', 'Clicks', 'Cost');
文件 /vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/v201603/ReportDefinitionService.php 中没有选择器定义,而此 class 在许多其他服务中定义。
我正在尝试让它在 Laravel 5.1
上运行如果我将目录 vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603 添加到我的 classmap:
,错误就会消失"autoload": {
"classmap": [
...
"vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603"
],
...
但我不确定我是否能做到。知道出了什么问题吗?
您所做的是正确的,符合 this section 中的预期。
需要手动 classmap,因为在 src/Google/Api/Ads/AdWords/Util
.
在 DownloadCriteriaReport 示例中,我认为您已经将其中的一些部分带到这里,ReportUtils.php 文件包含在第 29 行。 在 ReportUtils 中,class 选择器在包含 ReportClasses 文件时声明。
希望对您有所帮助。
萨尼特, AdWords API 团队