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
삶은 짐이 아니다. 우리는 자기 내면에 혼란을 일으킴으로써, 또 끝없이 과거를 생각하고 미래를 위한 계획에만 몰두함으로써, 그리고 현재를 생각하지 않음으로써 삶을 짐으로 만든다. (바바하라다스)