게시 된 PHP 값으로 XML 노드 값을 업데이트하려고했습니다.DOM을 사용하여 업데이트하는 동안 XML에서 새 줄 encyption (& # 13)을 이스케이프합니다. PHP
<name>test
test123</name>
는 결과가
$xml_Document = new DOMDocument();
$xml_Document->load('test.xml');
$employees = $xml_Document->getElementsByTagName("employees");
foreach($employees as $employee)
{
$names = $employee->getElementsByTagName("name");
$names->item(0)->nodeValue = $_POST["text1"];
}
$xml_Document->save('test.xml');
몇 가지 제안/솔루션을
[php : UTF-8을 쓸 때마다 DomDocument를 사용하여 16 진수 표기법을 씁니다.] (http://stackoverflow.com/questions/3575109/php-using-domdocument) -w-it-to-write-utf-8-it-writes-the-16 진법 -no) – Gordon
libxml2는'\ r'을 명시 적으로 ' ' – arnaud576875