我有很大困難。我需要從這個多維數組中檢索[title],[url]和[abstract]值。從多維數組中檢索值
此外,我必須在mysql數據庫中存儲這些值。
在此先感謝!
Array ( [bossresponse] => Array ( [responsecode] => 200 [limitedweb] => Array ( [start] => 0 [count] => 20 [totalresults] => 972000 [results] => Array ( [0] => Array ( [date] => [clickurl] => http://www.torchlake.com/ [url] => http://www.torchlake.com/ [dispurl] => www.torchlake.com [title] =>Torch Lake, COLI Inc, Highspeed, Dial-up, Wireless ... [abstract] => Welcome to COLI Inc. Chain O' Lake Internet. Local Northern Michigan ISP, offering Dialup Internet access, Wireless access, Web design, and T1 services in Northern ... ) [1] => Array ( [date] => [clickurl] => http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [url] => http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [dispurl] => en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [title] =>Torch Lake (Antrim County, Michigan) - Wikipedia, the free ... [abstract] =>Torch Lake at 19 miles (31 km) long is Michigan's longest lake and at approximately 18,770 acres (76 km²) is Michigan's second largest lake. Within it are several ... )
這是產生這種陣列的全部代碼:
require("OAuth.php"); $cc_key = ""; $cc_secret = ""; $url = ""; $args = array(); $args["q"] = "car"; $args["format"] = "json"; $args["count"] = 20; $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args); $request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL); $url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args)); $ch = curl_init(); $headers = array($request->to_header()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp, true);
你應該解釋一下,你需要做的這陣我必須找回在mysql數據庫標題,摘要和URL和存儲 在我的數據庫中,我有表名爲文本給一個簡單的例子 – Reflective
到底是什麼,它有3個領域:標題,描述和網址。 在title字段中,我需要來自title的商店值,來自abstract的描述字段值等 –