【发布时间】:2015-01-02 23:30:03
【问题描述】:
我已经创建了一个查询 API 的函数:
public function get_item($item_id = NULL)
{
$client = new Client();
$url_string = $this->base_api."/item/".$item_id.$this->after_item;
//https://hacker-news.firebaseio.com/v0//item/8705967.json?print=pretty
$response = $client->get($url_string);
return $response;
}
这是我收到的回复:
HTTP/1.1 200 OK
Content-Length: 385
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
{ "by" : "theuser", "id" : 8705967, "parent" : 8705928, "text" : "I've done them all. Here's my writeup on the pros/cons of each: http://awebsite.com/the-definitive-guide-to-pro...", "time" : 1417804054, "type" : "comment" }
我将如何处理此类数据?为了能够将它放在数组中并对其进行操作。
【问题讨论】:
标签: php json codeigniter