insert_data($themedata); } } } //关闭 closedir($dh); } } function readthemedata($xmlpath){ $importtxt = @implode('',file($xmlpath)); $data = xml2array($importtxt,FALSE,'UTF-8'); //$_attributes=xmlattribute($importtxt,'UTF-8'); //item 属性获取 $themearr = [ 'themename'=>$data['themename'], 'colors'=>isset($data['colors']) ? trim($data['colors']):'', 'selcolor'=>isset($data['defaultcolor']) ? $data['defaultcolor']:'', 'themestyle'=>isset($data['modulestyle']) ? serialize($data['modulestyle']):'' ]; return $themearr; } exit('success');