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)
85
将返回$result = $array['result'][0]
$result[0] //Returns 85 again
将为您提供一种将Result数组保存到另一个数组的好方法。
所以你可以做到
$data['result']
答案 1 :(得分:0)
您的foreach($data['result'] as $result) {
var_dump($result);
echo $result[0];
echo $result['proj_item_title'];
echo $result['proj_id']; //etc
}
是一个数组,因此您可以简单地遍历元素
$('.form-control').focus(function() {
$('#element').on('scroll touchmove mousewheel', function(e){
e.preventDefault();
e.stopPropagation();
})
});