【发布时间】:2019-04-29 14:59:50
【问题描述】:
我的框架是 codeigniter,我制作这样的库:
function checkOut($url, $params){
$client = new GuzzleHttp\Client([
'headers' => [ 'Content-Type' => 'application/json' ,'Accept' => 'application/json; charset=utf-8'],
'verify' => false,
'cookies' => true
]);
$response = $client->request('POST', $url, [
'json' => $params
]);
return $response->getBody->getContents();
}
我在我的控制器中这样调用这些库:
$dataArray is some array was i make,
$response_checkout = $this->corekredivo->checkOut($url, $dataArray)
在视图中我只是解析为这样的视图:
$data = array(
'_respon' => $response_checkout
);]
但是,当var_dump(); 在视图中时,结果是:
string(90) "{"status": "ERROR", "error": {"message": "发生了什么事 错误。", "kind": "APIException"}}"
在此之前我在邮递员中尝试过并且成功并且使用的数组的结构是相同的。
【问题讨论】:
-
请参考此link 了解如何接受答案。要将答案标记为已接受,请单击答案旁边的复选标记以将其从灰色切换为已填充。