可能重复:
PHP 将 XML 转换为 JSON
这是我的输出 XML 示例的样子:
<item>
<Barcode>0602527522593</Barcode>
<albumid>1818</albumid>
<Title>Gold</Title>
<Country>Sweden</Country>
<Format>CD</Format>
<Length></Length>
<Number_of_Discs></Number_of_Discs>
<Type>album</Type>
<Description></Description>
<Band_or_Artist>Adams, Ryan</Band_or_Artist>
</item>
是否有易于使用的内置 PHP 函数或插件快速将其转换为 JSON 并输出?如果它不是内置的,我应该使用哪个扩展?