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
전깃불이 나간 어두운 방안에서 초가 있으면서도 초를 아끼느라 켜지 않는다면 어떻게 될까. 마찬가지로 한두 마디의 상냥한 말이면 상대방의 마음을 밝게 해 주고 유쾌한 분위기를 만들 수 있는데 그러지 않는다면 그것은 마치 초를 아끼기 위해 어둠 속에 있는 것과 같다. (T. 제퍼슨)