所以,我想最終爲XML創建一個DOM對象,但是,$ xml_dom似乎是空的。 var_dump顯示對象(DOMElement)#3(0){}。 $ xml_simple很好。我在這裏做錯了什麼?dom_import_simplexml()返回一個空對象(PHP)
$get_url_report = 'http://...'; // contains well-formatted XML data
$xml_simple = simplexml_load_string(file_get_contents($get_url_report));
$xml_dom = dom_import_simplexml($xml_simple);
你是對的。註釋鏈接中描述的行可用。儘管如此,如果沒有正確的縮進,很難閱讀。我現在可以堅持使用SimpleXML。 – musicliftsme