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
해가 들면 어떻고, 바람이 불면 어떻고, 눈이 오면 어떠랴. 해가 들어주어도 고맙고, 바람이 불어주어도 고맙고, 눈이 와주어도 고마울 뿐. 그렇다, 고맙지 않은 것이 없다. 밤은 밤이어서 고맙고, 새벽은 새벽이어서 고맙고, 낮은 낮이어서 고맙다. 아, 고마운 삼라만상이여! (정채봉)