[导读]:?php// $file : xml 文件路径function read_xml($file) { $fh = fopen("$file",'r') or die($php_errormsg); $simple = fread($fh,filesize("$file")); fclose($fh) or die($php_errormsg); $p = xml_parser_create(); xml_parse_into_struct($...
<?php // $file : xml 文件路径 function read_xml($file) { $fh = fopen("$file",'r') or die($php_errormsg); $simple = fread($fh,filesize("$file")); fclose($fh) or die($php_errormsg); $p = xml_parser_create(); xml_parse_into_struct($p, $simple, $vals, $index); xml_parser_free($p); $meta[status] = $vals[$index[STATUS][0]][value]; $meta[paiva] = $vals[$index[PAIVA][0]][value]; $meta[alkuaika] = $vals[$index[ALKUAIKA][0]][value]; $meta[loppuaika] = $vals[$index[LOPPUAIKA][0]][value]; $meta[tiedosto] = $vals[$index[TIEDOSTO][0]][value]; $meta[koko] = $vals[$index[KOKO][0]][value]; $meta[otsikko] = $vals[$index[OTSIKKO][0]][value]; $meta[tyyppi] = $vals[$index[TYYPPI][0]][value]; $meta[kohde] = $vals[$index[KOHDE][0]][value]; $meta[lahde] = $vals[$index[LAHDE][0]][value]; $meta[toimittaja] = $vals[$index[TOIMITTAJA][0]][value]; $meta[teksti] = $vals[$index[TEKSTI][0]][value]; return $meta; } ?>
本文来自投稿,不代表微盟圈立场,如若转载,请注明出处:https://www.vm7.com/a/ziyuan/111622.html