common.php 377 B

12345678910111213141516
  1. <?php
  2. if (!function_exists('arrayToDic')) {
  3. /**
  4. * 数组转键值对数组
  5. * @param $array
  6. */
  7. function arrayToDic($array,$keyName="value",$valueName="label"){
  8. $dic=[];
  9. foreach ($array as $key=>$value){
  10. $item[$keyName]=$key;
  11. $item[$valueName]=$value;
  12. $dic[]=$item;
  13. }
  14. return $dic;
  15. }
  16. }