xml 和 array的相互转换支持 xml的属性 cdata

前端之家收集整理的这篇文章主要介绍了xml 和 array的相互转换支持 xml的属性 cdata前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!-- lang: xml -->
<response>
<header>
	<rspCode>000</rspCode>
	<rspDesc>执行成功</rspDesc>
	<rspTime>2012-02-17 00:00:00</rspTime>
</header>
<body>
  <productList page="page" pageSize="pageSize" pageCount="pageCount" totalCount="totalCount">
   <product>

sceneryId sceneryName ticketTypeId ticketTypeName parPrice webPrice settlementPrice

转成 Array ( [response] => Array ( [header] => Array ( [rspCode] => 000 [rspDesc] => 执行成功 [rspTime] => {2012-02-17 00:00:00} )
[body] => Array
            (
                [productList] => Array
                    (
                        [product] => Array
                            (
                                [sceneryId] => {sceneryId}
                                [sceneryName] => {sceneryName}
                                [ticketTypeId] => {ticketTypeId}
                                [ticketTypeName] => {ticketTypeName}
                                [parPrice] => {parPrice}
                                [webPrice] => {webPrice}
                                [settlementPrice] => {settlementPrice}
                            )

                        [@attributes] => Array
                            (
                                [page] => {page}
                                [pageSize] => {pageSize}
                                [pageCount] => {pageCount}
                                [totalCount] => {totalCount}
                            )

                    )

            )

    )

)

原文链接:https://www.f2er.com/xml/300288.html

猜你在找的XML相关文章