• <i id='aTx83'><tr id='aTx83'><dt id='aTx83'><q id='aTx83'><span id='aTx83'><b id='aTx83'><form id='aTx83'><ins id='aTx83'></ins><ul id='aTx83'></ul><sub id='aTx83'></sub></form><legend id='aTx83'></legend><bdo id='aTx83'><pre id='aTx83'><center id='aTx83'></center></pre></bdo></b><th id='aTx83'></th></span></q></dt></tr></i><div id='aTx83'><tfoot id='aTx83'></tfoot><dl id='aTx83'><fieldset id='aTx83'></fieldset></dl></div>
    <tfoot id='aTx83'></tfoot>

    1. <legend id='aTx83'><style id='aTx83'><dir id='aTx83'><q id='aTx83'></q></dir></style></legend>

      • <bdo id='aTx83'></bdo><ul id='aTx83'></ul>

        <small id='aTx83'></small><noframes id='aTx83'>

      1. 使用 SimpleXML 获取属性和值

        Get attributes and values using SimpleXML(使用 SimpleXML 获取属性和值)

            <i id='nqLNQ'><tr id='nqLNQ'><dt id='nqLNQ'><q id='nqLNQ'><span id='nqLNQ'><b id='nqLNQ'><form id='nqLNQ'><ins id='nqLNQ'></ins><ul id='nqLNQ'></ul><sub id='nqLNQ'></sub></form><legend id='nqLNQ'></legend><bdo id='nqLNQ'><pre id='nqLNQ'><center id='nqLNQ'></center></pre></bdo></b><th id='nqLNQ'></th></span></q></dt></tr></i><div id='nqLNQ'><tfoot id='nqLNQ'></tfoot><dl id='nqLNQ'><fieldset id='nqLNQ'></fieldset></dl></div>

              <tbody id='nqLNQ'></tbody>
            <tfoot id='nqLNQ'></tfoot>

            <small id='nqLNQ'></small><noframes id='nqLNQ'>

            1. <legend id='nqLNQ'><style id='nqLNQ'><dir id='nqLNQ'><q id='nqLNQ'></q></dir></style></legend>

                • <bdo id='nqLNQ'></bdo><ul id='nqLNQ'></ul>
                • 本文介绍了使用 SimpleXML 获取属性和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我真的不明白如何在 PHP 中使用 SimpleXML.

                  I really don't understand how to use SimpleXML in PHP.

                  这是我的 XML 文件的示例:

                  Here is an exemple of my XML file:

                  <?xml version="1.0" encoding="UTF-8" ?>
                  <eventlog version="1.1">
                  
                  <event source="Firewall" timeStamp="1308433939" type="0" deleted="0" bodyLength="218">
                  <subject>Network access detected</subject>
                  <action>Allowed</action>
                  <message>The program c:xamppapacheinhttpd.exe attempted to connect to the Internet. The program used the protocol TCP on port 80.</message>
                  </event>
                  
                  </eventlog>
                  

                  我需要检索这个:来源、时间戳、主题、操作、消息

                  I need to retrieve this: Source, Timestamp, Subject, Action, Message

                  我只是不明白.有人可以帮我解决这个问题吗?

                  I just don't get it. Can someone please help me with this?

                  推荐答案

                  这段代码应该可以工作:

                  This code should work:

                  $xml = new SimpleXMLElement($xmlString);
                  $source = $xml->event->attributes()->source;
                  $timestamp = $xml->event->attributes()->timestamp;
                  $subject = $xml->event->subject;
                  $action = $xml->event->action;
                  $message = $xml->event->message;
                  

                  ... 其中 $xmlString 是 xml 文件的字符串.

                  ... where $xmlString is the string of the xml file.

                  阅读如何使用 simpleXML这里.

                  Read up on how to use simpleXML here.

                  希望这会有所帮助,祝你好运!

                  Hope this helped and good luck!

                  这篇关于使用 SimpleXML 获取属性和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='iwBti'></bdo><ul id='iwBti'></ul>
                      <tfoot id='iwBti'></tfoot>
                      • <i id='iwBti'><tr id='iwBti'><dt id='iwBti'><q id='iwBti'><span id='iwBti'><b id='iwBti'><form id='iwBti'><ins id='iwBti'></ins><ul id='iwBti'></ul><sub id='iwBti'></sub></form><legend id='iwBti'></legend><bdo id='iwBti'><pre id='iwBti'><center id='iwBti'></center></pre></bdo></b><th id='iwBti'></th></span></q></dt></tr></i><div id='iwBti'><tfoot id='iwBti'></tfoot><dl id='iwBti'><fieldset id='iwBti'></fieldset></dl></div>

                        <small id='iwBti'></small><noframes id='iwBti'>

                        • <legend id='iwBti'><style id='iwBti'><dir id='iwBti'><q id='iwBti'></q></dir></style></legend>

                              <tbody id='iwBti'></tbody>