【发布时间】:2023-04-08 12:37:02
【问题描述】:
我想把打印出来的结果返回给其他函数使用。
代码如下:
"Keyword idea text '%s' has %d average monthly searches and competition as %d.%s",
$result->getText()->getValue(),
is_null($result->getKeywordIdeaMetrics()) ?
0 : $result->getKeywordIdeaMetrics()->getAvgMonthlySearches()->getValue(),
is_null($result->getKeywordIdeaMetrics()) ?
0 : $result->getKeywordIdeaMetrics()->getCompetition(),
PHP_EOL
);
return
结果是这样的:关键字创意文本“a”的平均每月搜索量为 1600 次,竞争为 4。 关键字创意文本“b”平均每月搜索 10 次,竞争次数为 2。 关键字创意文本“c”的平均每月搜索次数为 10,竞争次数为 4。
这是打印出来的
我想像“a,b,c”一样返回
如何将此结果存储在一个字符串中并返回......所以我可以在其他功能中使用
【问题讨论】:
-
return $result->getText()->getValue() . ',' . is_null($result->getKeywordIdeaMetrics()) ? 0 : $result->getKeywordIdeaMetrics()->getAvgMonthlySearches()->getValue() . ',' . is_null($result->getKeywordIdeaMetrics()) ? 0 : $result->getKeywordIdeaMetrics()->getCompetition(); -
给定代码的确切问题是什么?
标签: php symfony google-ads-api