태그를 안먹게 한다 태그를 string 으로 바꿔 준다
htmlspecialchars
(PHP 4, PHP 5)
htmlspecialchars — Convert special characters to HTML entities
Description ¶
$string
[, int $flags
= ENT_COMPAT | ENT_HTML401 [, string $encoding
= ini_get("default_charset") [, bool $double_encode
= true ]]] )Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with these conversions made. If you require all input substrings that have associated named entities to be translated, use htmlentities() instead.
If the input string passed to this function and the final document share the same character set, this function is sufficient to prepare input for inclusion in most contexts of an HTML document. If, however, the input can represent characters that are not coded in the final document character set and you wish to retain those characters (as numeric or named entities), both this function and htmlentities() (which only encodes substrings that have named entity equivalents) may be insufficient. You may have to use mb_encode_numericentity() instead.
The translations performed are:
- '&' (ampersand) becomes '&'
- '"' (double quote) becomes '"' when
ENT_NOQUOTES
is not set. - "'" (single quote) becomes ''' (or ') only when
ENT_QUOTES
is set. - '<' (less than) becomes '<'
- '>' (greater than) becomes '>'
Parameters ¶
http://php.net/manual/en/function.htmlspecialchars.php
'PHP' 카테고리의 다른 글
MYSQL 페이징할때 SQL_CALC_FOUND_ROWS를 쓰자 (0) | 2015.09.04 |
---|---|
php 와 java에서 string 사용시 큰차이 (0) | 2015.08.27 |
php date() 함수 (0) | 2015.08.11 |
php explode 문자열 잘라 쓰기 (0) | 2015.08.07 |
php와 java string 연결 문법 차이 (0) | 2015.08.07 |