<?php
$xml =<<<EOL
<TimelineObject>
<id><![CDATA[12577372733072486582]]></id>
<username><![CDATA[wxid_lj7cpmhigv9h12]]></username>
<createTime><![CDATA[1499339667]]></createTime>
<contentDescShowType>0</contentDescShowType>
<contentDescScene>3</contentDescScene>
<private><![CDATA[0]]></private>
<contentDesc><![CDATA[?个小时,总感觉腿不是自己的了。[坏笑]\u0003]]></contentDesc>
<contentattr><![CDATA[0]]></contentattr>
<sourceUserName></sourceUserName>
<sourceNickName></sourceNickName>
<statisticsData></statisticsData>
</TimelineObject>
EOL;
var_dump(simplexml_load_string($xml));
var_dump(simplexml_load_string($xml, null, LIBXML_NOCDATA));
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- object(SimpleXMLElement)#1 (11) {
["id"]=>
object(SimpleXMLElement)#2 (0) {
}
["username"]=>
object(SimpleXMLElement)#3 (0) {
}
["createTime"]=>
object(SimpleXMLElement)#4 (0) {
}
["contentDescShowType"]=>
string(1) "0"
["contentDescScene"]=>
string(1) "3"
["private"]=>
object(SimpleXMLElement)#5 (0) {
}
["contentDesc"]=>
object(SimpleXMLElement)#6 (0) {
}
["contentattr"]=>
object(SimpleXMLElement)#7 (0) {
}
["sourceUserName"]=>
object(SimpleXMLElement)#8 (0) {
}
["sourceNickName"]=>
object(SimpleXMLElement)#9 (0) {
}
["statisticsData"]=>
object(SimpleXMLElement)#10 (0) {
}
}
object(SimpleXMLElement)#1 (11) {
["id"]=>
string(20) "12577372733072486582"
["username"]=>
string(19) "wxid_lj7cpmhigv9h12"
["createTime"]=>
string(10) "1499339667"
["contentDescShowType"]=>
string(1) "0"
["contentDescScene"]=>
string(1) "3"
["private"]=>
string(1) "0"
["contentDesc"]=>
string(60) "?个小时,总感觉腿不是自己的了。[坏笑]\u0003"
["contentattr"]=>
string(1) "0"
["sourceUserName"]=>
object(SimpleXMLElement)#10 (0) {
}
["sourceNickName"]=>
object(SimpleXMLElement)#9 (0) {
}
["statisticsData"]=>
object(SimpleXMLElement)#8 (0) {
}
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
object(SimpleXMLElement)#1 (11) {
["id"]=>
object(SimpleXMLElement)#2 (0) {
}
["username"]=>
object(SimpleXMLElement)#3 (0) {
}
["createTime"]=>
object(SimpleXMLElement)#4 (0) {
}
["contentDescShowType"]=>
string(1) "0"
["contentDescScene"]=>
string(1) "3"
["private"]=>
object(SimpleXMLElement)#5 (0) {
}
["contentDesc"]=>
object(SimpleXMLElement)#6 (0) {
}
["contentattr"]=>
object(SimpleXMLElement)#7 (0) {
}
["sourceUserName"]=>
object(SimpleXMLElement)#8 (0) {
}
["sourceNickName"]=>
object(SimpleXMLElement)#9 (0) {
}
["statisticsData"]=>
object(SimpleXMLElement)#10 (0) {
}
}
object(SimpleXMLElement)#1 (11) {
["id"]=>
string(20) "12577372733072486582"
["username"]=>
string(19) "wxid_lj7cpmhigv9h12"
["createTime"]=>
string(10) "1499339667"
["contentDescShowType"]=>
string(1) "0"
["contentDescScene"]=>
string(1) "3"
["private"]=>
string(1) "0"
["contentDesc"]=>
string(60) "?个小时,总感觉腿不是自己的了。[坏笑]\u0003"
["contentattr"]=>
string(1) "0"
["sourceUserName"]=>
object(SimpleXMLElement)#10 (0) {
}
["sourceNickName"]=>
object(SimpleXMLElement)#9 (0) {
}
["statisticsData"]=>
object(SimpleXMLElement)#8 (0) {
}
}
preferences:
149.97 ms | 405 KiB | 172 Q