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
인생은 자유로이 여행할 수 있도록 시원하게 뚫린 대로가 아니다. 때로는 길을 잃고 헤매기도 하고 때로는 막다른 길에서 좌절하기도 하는 미로와 같다. (누가 내 치즈를 옮겼을까? 중에서)