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
살아 있는 동안 더 많이 감탄하세요. 가슴을 열고 보면 어디 감탄할 거리가 한두 가지입니까. 감탄할 거리가 있을때가 참을 것이 아니라 즉각 감탄해야 합니다. 가슴 두근거리고 놀라고 환호할때 우리의 행복은 곱으로 느껴집니다. (정채봉)