时间:2021-07-01 10:21:17 帮助过:2人阅读
array_key_exists("value",$res[0])
$arr = Array ('0' => Array ( 'tagname' => 'KF_FIC01341.TOTALIZERA_2.PV','units' => 'KNm3', 'value' => 0 ) ,'1' => Array ( 'tagname' => 'KF_FIC01342.TOTALIZERA_4.PV', 'units' => 'KNm3' ,'value' => 0 ));function check_index ( $item , $key ){ if(array_key_exists("value",$item)){ echo "存在此键值"."
"; }else{ echo "没有此键值"."
"; }}array_walk ( $arr , 'check_index' );
$arr=array ( 0 => array ( 'tagname' =>'KF_FIC01341.TOTALIZERA_2.PV', 'units' => 'KNm3', 'value' => 0 ),1 => array ( 'tagname' =>'KF_FIC01342.TOTALIZERA_4.PV', 'units'=> 'KNm3', 'value' => 0 ) );function my(){ $arr=func_get_args(); foreach($arr as $k=>$v){ $item=array_key_exists('value',$v); if($item) { echo '存在'; break; }else{ '不存在'; } }}call_user_func_array('my',$arr);
版主方法最简单,谢谢各位~~