我想返回打印的结果,用于其他功能。这是代码:"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”的平均每月搜索和竞争为 4。关键字创意文本“b”的平均每月搜索和竞争为 2。关键字创意文本“c”的平均每月搜索和竞争为 10作为 4。这是打印的方式我想像“a、b、c”一样返回如何将此结果存储在一个字符串中并返回 ....这样我就可以在其他函数中使用
1 回答
侃侃无极
TA贡献2051条经验 获得超10个赞
第一种方法:
return $a . ',' . $b . ',' . $c;
第二种方法
$arr = [$a, $b, $c];
return implode(",", $arr);- 1 回答
- 0 关注
- 160 浏览
添加回答
举报
0/150
提交
取消
