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
나는 단지 한 사람의 인간에 불과하다. 그렇더라도 나는 어디까지나 인간이다. 나는 모든 것을 다 할 수는 없다. 그렇더라도 나는 어떤 것은 할 수 있다. 그리고 모든 것을 다 할 수 없다고 해서 내가 할 수 있는 어떤 것까지 포기하지는 않을 것이다. (에드워드 에버렛 해일)