2017-01-20 4 views
-1
Array ([err] => [num] => 1 [result] => Array ([0] => Array ([0] => 85 [proj_id] => 85 [1] => Automatic Mobile Alert System For Lethal Gas Detection [proj_item_title] => Automatic Mobile Alert System For Lethal Gas Detection [2] => GSM PROJECTS [proj_category] => GSM PROJECTS [3] => 5000 [actual_price] => 5000 [4] => 4000 [discount_price] => 4000 [5] => 5 [rating] => 5 [6] => automatic-mobile-alert-system-for-lethal-gas-detection [friendly_url] => automatic-mobile-alert-system-for-lethal-gas-detection [7] => gsnrtmccfoqqkgb8qs2ni5hud36c032j [session_id] => gsnrtmccfoqqkgb8qs2ni5hud36c032j [8] => 85 [9] => 2017-01-20 [date_added] => 2017-01-20 [10] => 1 [qty] => 1))) 

配列 "result"から要素にアクセスする必要があります。どうすればそれらにアクセスできますか?私を助けてください。内部配列からの値へのアクセス

+0

$データ[ "結果"]を超える配列することができますので、単純にループで –

答えて

0

echo $array['result'][0][0]

85

$result = $array['result'][0]

を返します、あなたに別の結果を配列に配列を保存するための良い方法を提供します。

あなたは

$result[0] //Returns 85 again

0

を行うことができますので、あなたの$data['result']は要素

foreach($data['result'] as $result) { 
    var_dump($result); 
    echo $result[0]; 
    echo $result['proj_item_title']; 
    echo $result['proj_id']; //etc 
} 
+0

はありがとうロバート、萌えと助けを求めるシディキ。私はあなたが私の質問に費やした時間に感謝しています。時間は貴重です。 – user7321290

関連する問題