php method to convert xml into object: [$xml= "<xml><appid>123456</appid></xml>"; $objectxml = simplexml_load_string($xml);].
The operating environment of this article: windows10 system, php 7, thinkpad t480 computer.
XML file
$xml= "<xml><appid>123456</appid></xml>";
Convert file to object
$objectxml = simplexml_load_string($xml);
Convert object to JSON
$xmljson= json_encode($objectxml );
Convert json to array
$xmlarray=json_decode($xmljson,true);
Recommended learning: php training
The above is the detailed content of How to convert xml into object in php. For more information, please follow other related articles on the PHP Chinese website!