PHP & Others

input text 따옴표 처리

컨텐츠 정보

본문

<input type="text" value="<?php echo htmlentities($myValue); ?>">


htmlspecialchars($myValue, ENT_QUOTES, 'UTF-8');

'&' (ampersand) becomes '&amp;'

'"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set.

''' (single quote) becomes '&#039;' only when ENT_QUOTES is set.

'<' (less than) becomes '&lt;'

'>' (greater than) becomes '&gt;'



htmlspecialchars 는 예약된 HTML 문자만 인코딩하는 반면 htmlentities 는 HTML 표현이 있는 모든 것을 변환합니다

관련자료

댓글 0
등록된 댓글이 없습니다.
Today's proverb
너의 하루하루가 너를 형성한다. 그리고 머지 않아 한 가정을, 지붕 밑의 온도를 형성할 것이다. 또한 그 온도는 이웃으로 번져 한 사회를 이루게 될 것이다. 이렇게 볼 때 너의 ‘있음’은 절대적인 것이다. 없어도 그만인 존재가 아니라는 말이다. (법정스님)