How can i read the first XML comment in PHP?
问题 How can I read the first and only comment in PHP: <?xml version="1.0" encoding="UTF-8"?> <!-- read this --> <root> </root> using DOMDOcument object? $xml = new DOMDocument(); $libxml_error = 'Il file %s non risulta ben formato (%s).'; // Per evitare i warning nel caso di xml non ben formato occorre sopprimere // gli errori if (!@$xml -> load($xml_file_path)) $error = sprintf($libxml_error, $xml_file_path, libxml_get_last_error()->message); // Read the fist comment in xml file 回答1: What about