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
아무리 친한 사이라도 둘 사이를 파괴하고 싶지 않으면, 그리고 오래 지속시키고 싶으면, 어느 정도의 예의는 필요한 법이다. (필립 체스터필드의 “내 아들아 너는 인생을 이렇게 살아라” 중에서)