php code$str1 = http://user.qzone.qq.com/1340477530#!app=2&pos=1300412602;$xml = ''.\r\n;$xml .= ''.\r\n;$xml .= \t.''.$str1.''.\r\n;$xml .= ''.\r\n;$sxe = new simplexmlelement($xml);$sxe->asxml('test.xml');
运行后发现如下错误,
html codearning: simplexmlelement::__construct() [simplexmlelement.--construct]: entity: line 3: parser error : entityref: expecting ';' in c:\wamp\www\test\a.php on line 18warning: simplexmlelement::__construct() [simplexmlelement.--construct]: http://user.qzone.qq.com/1340477530#!app=2\&pos=1300412602in c:\wamp\www\test\a.php on line 18
将$str1中的 & 去掉后就正常了,这是为什么啊。。有什么解决办法吗?谢谢~~
------解决方案--------------------
$xml .= \t.''.htmlentities($str1).''.\r\n;
