时间:2021-07-01 10:21:17 帮助过:5人阅读
你的传入参数 $name、$value 含义是什么?打算让函数返回什么?
orderstatus[1][0]=label;orderstatus[1][1]=label-warning;orderstatus[1][2]=未发货;
orderstatus[2][0]=label;orderstatus[1][1]=label-primary;orderstatus[1][2]=已发货;
...............................
应该是这样获取对应的数组中的值
????
function get_base_data($name,$value){ $web_data_init=array( "currencies"=>array("GBP","USD","JPY","EUR","CAD","CNY"), "country_D"=>array( "UK"=>"GBP", "DE"=>"EUR", "IT"=>"EUR", "FR"=>"EUR", "US"=>"USD", "UK"=>"GBP", "JP"=>"JPY", "CA"=>"CAD", "CN"=>"CNY", ), "orderstatus"=>array( "1" =>array("label label-warning","未发货"), "2" =>array("label label-primary","已发货"), "0" =>array("label label-default","已取消"), "3" =>array("label label-success","已完成"), "4" =>array("label label-danger","退款"), "5" =>array("label label-info","地址确认中"), "6" =>array("label label-info","少货"), ) ); if(isset($web_data_init[$name][$value])){ return $web_data_init[$name][$value]; }else{ return ''; }}$data = get_base_data("orderstatus","1");if(is_array($data)){ print_r($data);}else{ echo $data;}