PHP格式化接口返回的营业执照信息(来源:梦行云软件)
function format_business_info($v){//格式化营业执照信息
if(isset($v['统一社会信用代码'])){$v['certificate_id']=$v['统一社会信用代码']['words'];}else{$v['certificate_id']='';}
if(isset($v['经营范围'])){$v['main_business']=$v['经营范围']['words'];}else{$v['main_business']='';}
if(isset($v['法人'])){$v['master']=$v['法人']['words'];}else{$v['master']='';}
if(isset($v['法定代表人'])){$v['master']=$v['法定代表人']['words'];}
if(isset($v['住所'])){$v['address']=$v['住所']['words'];}else{$v['address']='';}
if($v['address']=='' && isset($v['地址'])){$v['address']=$v['地址']['words'];}
if(isset($v['单位名称'])){$v['name']=$v['单位名称']['words'];}else{$v['name']='';}
if($v['name']=='' && isset($v['名称'])){$v['name']=$v['名称']['words'];}
if(isset($v['注册资本'])){$v['money']=$v['注册资本']['words'];}else{$v['money']='';}
if(isset($v['类型'])){$v['type']=$v['类型']['words'];}else{$v['type']='';}
if(isset($v['成立日期'])){$v['start']=$v['成立日期']['words'];}else{$v['start']='';}
if(isset($v['有效期'])){$v['end']=$v['有效期']['words'];}else{$v['end']='';}
if(isset($v['营业期限'])){
$t=explode('至',$v['营业期限']['words']);
if($v['start']==''){$v['start']=$t[0];}
if($v['end']==''){$v['end']=@$t[1];}
}
return $v;
}