SimpleXML 数据丢失

发布于 2024-11-17 08:15:24 字数 2364 浏览 2 评论 0原文

我有一个 XML,我用 php simpleXML 解析它。

XML:

<GetOneGetAll DateTimeSystem="28-06-2011 17:19:29" RetCode="200" RetVal="1" RetMsg="User ok.">
    <User Id="bc5cb4cf-19a6-4504-8e1a-f72dd97bcc66" ReferedConfirmedUsers="0" TotalRecomendations="0" DistinctRecomendations="0">
        <Name>Name</Name>
        <Surname>Surname</Surname>
        <Gender>F</Gender>
        <Email>[email protected]</Email>
        <RefererCode>59286904</RefererCode>
        <CustomPhotoMessage HasCustomPhoto="0" HasCustomMessage="0"/>   
        <ReferedConfirmedUsersList/>
    </User>
</GetOneGetAll>

当我使用 simpleXML print_r var 时,我得到:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [DateTimeSystem] => 28-06-2011 17:22:52
            [RetCode] => 200
            [RetVal] => 1
            [RetMsg] => Login ok.
        )

    [User] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [Id] => bc5cb4cf-19a6-4504-8e1a-f72dd97bcc66
                    [ReferedConfirmedUsers] => 0
                    [TotalRecomendations] => 0
                    [DistinctRecomendations] => 0
                )

            [Name] => SimpleXMLElement Object
                (
                )

            [Surname] => SimpleXMLElement Object
                (
                )

            [Gender] => SimpleXMLElement Object
                (
                )

            [Email] => SimpleXMLElement Object
                (
                )

            [RefererCode] => SimpleXMLElement Object
                (
                )

            [CustomPhotoMessage] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [HasCustomPhoto] => 0
                            [HasCustomMessage] => 0
                        )

                )

            [ReferedConfirmedUsersList] => SimpleXMLElement Object
                (
                )
        )
)

姓氏、姓名、电子邮件、性别等数据在哪里?

I have a XML which I parse with php simpleXML.

The XML:

<GetOneGetAll DateTimeSystem="28-06-2011 17:19:29" RetCode="200" RetVal="1" RetMsg="User ok.">
    <User Id="bc5cb4cf-19a6-4504-8e1a-f72dd97bcc66" ReferedConfirmedUsers="0" TotalRecomendations="0" DistinctRecomendations="0">
        <Name>Name</Name>
        <Surname>Surname</Surname>
        <Gender>F</Gender>
        <Email>[email protected]</Email>
        <RefererCode>59286904</RefererCode>
        <CustomPhotoMessage HasCustomPhoto="0" HasCustomMessage="0"/>   
        <ReferedConfirmedUsersList/>
    </User>
</GetOneGetAll>

When I print_r the var using simpleXML I get:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [DateTimeSystem] => 28-06-2011 17:22:52
            [RetCode] => 200
            [RetVal] => 1
            [RetMsg] => Login ok.
        )

    [User] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [Id] => bc5cb4cf-19a6-4504-8e1a-f72dd97bcc66
                    [ReferedConfirmedUsers] => 0
                    [TotalRecomendations] => 0
                    [DistinctRecomendations] => 0
                )

            [Name] => SimpleXMLElement Object
                (
                )

            [Surname] => SimpleXMLElement Object
                (
                )

            [Gender] => SimpleXMLElement Object
                (
                )

            [Email] => SimpleXMLElement Object
                (
                )

            [RefererCode] => SimpleXMLElement Object
                (
                )

            [CustomPhotoMessage] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [HasCustomPhoto] => 0
                            [HasCustomMessage] => 0
                        )

                )

            [ReferedConfirmedUsersList] => SimpleXMLElement Object
                (
                )
        )
)

Where is the data of Surname, Name, Email, Gender, etc.?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡写薰衣草的香 2024-11-24 08:15:24

这只是一个猜测,但如果您安装了 xdebug,则默认递归级别为 var_dump 输出为 3。此设置为 xdebug.var_display_max_depth
您正在使用 print_r,但可能会达到一些类似的递归限制。

This is just a guess, but if you have xdebug installed, then the default recursion level of var_dump output is 3. This setting is xdebug.var_display_max_depth
You are using print_r, but some similar recursive limit could be being reached.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文