2017-01-06 2 views
0
SimpleXMLElement Object ([@attributes] => Array ([version] => 1.1 [encoding] => UTF-8) [forgotPassword] => SimpleXMLElement Object ([message] => User is not found. [status] => error)) 
+0

Ich möchte das Ergebnis daraus in PHP Ich verwende das: $ response-> vergessenPassword-> Nachricht; aber nie die Antwort erhalten –

+1

Sie sollten mehr Kontext zur Verfügung stellen, * innerhalb * Ihrer Frage (bearbeiten). Fügen Sie nur genügend Code ein, damit andere das Problem reproduzieren können. Hilfe hierzu finden Sie unter [Erstellen eines minimalen, vollständigen und überprüfbaren Beispiels] (http://stackoverflow.com/help/mcve). – trincot

Antwort

0

Ich benutze diese von den PHP-Handbuch Kommentare:

/** 
* function xml2array 
* 
* This function is part of the PHP manual. 
* 
* The PHP manual text and comments are covered by the Creative Commons 
* Attribution 3.0 License, copyright (c) the PHP Documentation Group 
* 
* @author k dot antczak at livedata dot pl 
* @date 2011-04-22 06:08 UTC 
* @link http://www.php.net/manual/en/ref.simplexml.php#103617 
* @license http://www.php.net/license/index.php#doc-lic 
* @license http://creativecommons.org/licenses/by/3.0/ 
* @license CC-BY-3.0 <http://spdx.org/licenses/CC-BY-3.0> 
*/ 
function xml2array ($xmlObject, $out = array()) 
{ 
    foreach ((array) $xmlObject as $index => $node) 
     $out[$index] = (is_object ($node)) ? xml2array ($node) : $node; 

    return $out; 
} 

Sie sollten es versuchen.

Verwandte Themen