使用simplexml_load_string
进行转换时,我无法从XML获取整个数据示例:XML的部分数据
<variable ident="592952" type="single" cint:sort-order="1"
cint:hide-on="Registration"
cint:country-language-question-id="2222">
当我使用simplexml_load_string并将它们包装在json_encode和json_decode中成为数组时,它将如下所示:
+"variable": SimpleXMLElement {#550 ▼
+"@attributes": array:2 [▼
"ident" => "782752"
"type" => "single"
]
问题:如何从XML格式的变量元素中获取cint:sort-order="1"
的值,并将其与一些变量放在一起,看起来像这样?这可能吗?
"variable": SimpleXMLElement {#550 ▼
+"@attributes": array:2 [▼
"ident" => "782752"
"type" => "single",
"cint:sort-order" =>"1",
"cint:hide-on" =>"Registration",
"cint:country-language-question-id" =>"2222"
]