use:
$xml = simplexml_load_string($content);
$array = json_decode(json_encode((array) $xml), 1);
When parsing XML into an array in this way,
For:
<a name="aaaa">
<b></b>
</a>
and
<a>content</a>
can be parsed correctly, but for this:
<a name="aaaa">content</a>
You cannot get the name attribute, but you can only get the content content.
Is there any good way to deal with this problem?