尝试从api调用返回一个项目数组,var_dump会吐出我想要的数组,但返回值始终为null。我错过了什么?非常感谢
echo $param, $this->test
答案 0 :(得分:0)
下面的固定和工作功能
function get_all_opened($mailgun, $domain, $list_address, $items, $page_advance = false, $next_url = false) {
$end_point = "{$domain}/events";
if($page_advance) {
$end_point = "{$domain}/events/{$next_url}";
}
//API Call
$stats = $mailgun->get($end_point, array(
'event' => 'opened',
'limit' => 25,
'list' => $list_address
));
$item_count = count($stats->http_response_body->items);
//add items to return array
if($item_count > 0) {
$items[] = $stats->http_response_body->items;
}
if($item_count > 24) {
$next_parts = explode ('/', $stats->http_response_body->paging->next);
$next_url = end($next_parts);
return get_all_opened($mailgun, $domain, $list_address, $items, true, $next_url);
} else {
return $items;
}
}