<?php function xml2array($contents, $get_attributes = 1, $priority = 'tag') { if (!$contents) return array(); if (!function_exists('xml_parser_create')) { // print "'xml_parser_create()' function not found!"; return array(); } // Get the XML parser of PHP - PHP must have this module for the parser to work $parser = xml_parser_create(''); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); // http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, trim($contents), $xml_values); xml_parser_free($parser); if (!$xml_values) return; //Hmm... // Initializations $xml_array = array(); $parents = array(); $opened_tags = array(); $arr = array(); $current = &$xml_array; //Refference // Go through the tags. $repeated_tag_index = array(); //Multiple tags with same name will be turned into an array foreach($xml_values as $data) { unset($attributes, $value); //Remove existing values, or there will be trouble // This command will extract these variables into the foreach scope // tag(string), type(string), level(int), attributes(array). extract($data); //We could use the array by itself, but this cooler. $result = array(); $attributes_data = array(); if (isset($value)) { if ($priority == 'tag') $result = $value; else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode }
XML? ??? ??? ??? ? ?? ??? ????????. ??? ??? ?????? ??? ? ????.
? ???? ?? ???? ???? ????? ?? ???? ????? ????????. ?????? ???? ?? ??????! ? ???? ?? ???? ?? ?????? ?????. ??? ???? ???? ??? ????. ??? ??? ?? ??? ?? ??? ???? ????! ??? ?? ?? ??? ???? ????? ????. ???: admin@php.cn
?? ??

02 May 2025
JSON, XML ? RSS? ?? ???? ??? 2. XML? ????? ??? ?? ??? ?? ??? ??? ??? ?????. 3. RSS? XML? ?????? ??? ???, ??????? ??? ??? ?????.

02 Apr 2025
PDF? XML? ???? ??? ?????? ??? ???, ???? ????? ?? ????? ?????? ???? ??? ?? ?? (XHTML, PDF/UA, XML)? ???? PDF (OCR, ???? ?? ??, ??? ??)? ????? ?? ?? (??, ?? ???, ??? ??) ?? ?? (Verification XML, ?? ??, ??), ??? ??, ?? ?? ??? ?????.

27 Aug 2025
? ????? ??? ??? ?? ?? ???? ???? PHP? ?? ??? ?? (? : ??, ?? ??? ?? ? ?? ?)?? ???? ???? ???? ??? ?????. ?? ?? ?? ?? ???? ?? ? ? ???? ? ?? ?? ??? ?? ????, ???? ??? JSON_NUMERIC_CHECK ? FILTER_VAR ??? ?? ? JSON_ENCODE? ???? ??? ?? ? ??? ???? ????, ??? ???? ??? ??? ???? ???? ??? ??? ?? ? ?? ? ???? ???? ? ??????.

01 Sep 2025
? ????? ??? ??? ??? ?? ??? ??? ? ?? ??? ???? ??? ????? ???????. ??? PHP ? JavaScript ??? ??? ??? ???? ???? ??? ??? ????. ?? ? ?? (? : array.prototyp.reduce for javaScript ? array_reduce)? ???? ?? ?? ??? ???? PHP? ??). ?? ??? ???? ??? ?? ???? ??? ???? ?? ???? ?? JSON ?? JavaScript ?? ???? ????? ????? ?? ?? ???? ??? ??? ??? ?? ??? ????? ??? ????.

01 Sep 2025
? ??? PHP ?? ???? ??? ?? ?? ? (? : '0'? '3')? ??? ?? ??? ??? (? : 'no'? 'yes')? ???? ??? ?? ??? ???? ?? ??????. ? ???? ?????? ISSET ??? ??? ??? ???? ??? ? ??? ???? ??? ?? ??? ?????. ???, ?? ? ???? ?? ??? ?? ??? ????, ??? ?? ?? ? ?? ?? ????? ?? ?? ?? ???? ??? ???? ???? ?? ????.

26 Mar 2025
? ??? & lt; thread & gt; ???, ?? ? ??? ?? ??. ?? ??? ??????? ?? ??? ???? ??? ?????.


??? ??

50?? ??? ??? PHP ???? ??
??? PHP ????, ??? ????? ??? ???? ?????

??? ?? ????? PHP ?????
??? ?? ????? PHP ?????

??? ???? ?? ?? PHP ?????
??? ???? ?? ?? PHP ?????
