5

ここに私の入力xmlがあります

   <app appid="{C38B7539}" lang="en">
      <updatecheck/>
   </app>

次のphpによって解析されます

$xmlObj = simplexml_load_string($xmlStr);
if ($xmlObj === false) {
    // log errors
    return;
}
print_r($xmlObj);

Windows での出力 (障害)

[app] => SimpleXMLElement Object
    (
        [@attributes] => Array
            (
                [appid] => {C38B7539}
                [lang] => en
            )

        [0] => SimpleXMLElement Object   <-- Note the 0 instead of updatecheck
            (
            )
    )

Linux での出力 (正しい)

[app] => SimpleXMLElement Object
    (
        [@attributes] => Array
            (
                [appid] => {C38B7539}
                [lang] => en
            )

        [updatecheck] => SimpleXMLElement Object
            (
            )
    )

その結果、Linux およびWindows でarray_key_exists('updatecheck', $xmlObj)戻ります。truefalse

Windows で動作するようにパーサー コードを修正するにはどうすればよいですか?

4

0 に答える 0