全部文本 #1322692 原始 编辑

timing

公开 php v1 · 不可变
·已发布 2009-01-30 11:28 UTC
渲染后的文本正文
<?php$dom = new DOMDocument( '1.0', 'UTF-8' );$test = $dom->createElement('test');$test->appendChild( $dom->createTextNode('Hello: \' | & | " | < | > ') );$dom->appendChild($test);echo $dom->saveXML();/* The upper code prints:<?xml version="1.0" encoding="UTF-8"?><test>Hello: ' | &amp; | " | &lt; | &gt; </test>Why aren't the ' and " escaped to &apos; and &quot; ?*/?>