有什么方法可以删除多余的写入请求方法?
所以这时我的代码看起来像这样
$response['slide'] = $this->_client->request('GET', 'artikelc/slidelimit',[
'query' => [
'auth-apikey' => $this->keyauth
]
]);
$this->data['slide_grab'] = json_decode($response['slide']->getBody()->getContents());
$response['subpost'] = $this->_client->request('GET', 'artikelc/subpost',[
'query' => [
'auth-apikey' => $this->keyauth
]
]);
$this->data['subpost_grab'] = json_decode($response['subpost']->getBody()->getContents());
$response['newsone'] = $this->_client->request('GET', 'artikelc/newsone',[
'query' => [
'auth-apikey' => $this->keyauth
]
]);
$this->data['newsone_grab'] = json_decode($response['newsone']->getBody()->getContents());
如您所见,我必须重写相同的代码。我可以使它更简单吗?
答案 0 :(得分:1)
您可以做的是简化通话:
>