개발관련
[PHP-Error] [Warning: DOMElement::__construct()
blesscdh
2009. 5. 19. 18:02
PHP에서 다음과 같은 경고가 나왔다.
Warning</b>: DOMElement::__construct()
[<a href='function.DOMElement---construct'>function.DOMElement---construct</a>]
: unterminated entity reference D in <b>
원인
DOMElement 에 포함될 Attributes에 포함될수 없는 문자들이 포함된 경우다.
이런 경우에는 특수문자를 처리할 수 있는 htmlSpecialChars() 함수를 이용해서
해당 값을 래핑해줘야한다.
결과
$key2에 특수문자등이 포함된경우.
$doc->appendChild(new DOMElement($key1, htmlSpecialChars($key2)))
----------------------------------------------------------------------