开发者

Get root node of XML doc using simplexml

开发者 https://www.devze.com 2022-12-30 09:46 出处:网络
Using simplexml_load_string() how do I get \"ForgotPassword\" from the following XML? <?xml version=\"1.0\" encoding=\"utf-8\"?>

Using simplexml_load_string() how do I get "ForgotPassword" from the following XML?

<?xml version="1.0" encoding="utf-8"?>
<ForgotPassword>
    <version>1.0</version>
    <authentication>
        <login>username</logi开发者_运维百科n>
        <apikey>login</apikey>
    </authentication>
    <parameters>
        <emailAddress>joesmith@example.com</emailAddress>
    </parameters>
</ForgotPassword>


Are you wanting to get the name of the root node?

$xml = simplexml_load_string($str);
echo $xml->getName();
0

精彩评论

暂无评论...
验证码 换一张
取 消