NL2BR (); N to
Addslashes (); Strips tutorial Lashes (); Escape special characters when working with database tutorials
Definition: the Addslashes () function adds a backslash before the specified predefined character.
Syntax: Addslashes (String)
Note: By default, PHP instruction MAGIC_QUOTES_GPC is on, and automatically runs Addslashes () for all get, post, and cookie data. Do not use Addslashes () for strings that have been MAGIC_QUOTES_GPC escaped, because this results in double-layer escaping. You can use the function GET_MAGIC_QUOTES_GPC () to detect this situation.
function Addslashes_str ($STR) {
$str =addslashes ($STR);
$str =str_replace ($str, ";", '; ');
return $str;
}
function Stripslashes_str ($STR) {
$str =stripslashes ($STR);
$str =str_replace ($str, '; ', ";");
return $str;
}
?>
Chop (); Remove the right space from the string
Trim (); Remove all spaces in a string
LTrim (); Remove the left space of a string
Htmlspecialchars (); Convert ' $ ', ' ' ', ' < ', ' > ' for the corresponding HTML entity
Htmlentities (); Convert all HTML tags to the appropriate HTML entity
Array explode (string separator, string str); Split string
String implode (string separator, array arr); Connection string
Strtoupper (); Strtolower (); Convert case
Ucfirst (); Convert only the first character to uppercase
Ucwords (); Convert the first letter of each words to uppercase
Iconv ()
PHP Internal code conversion function, IBID.
Because Iconv () is a bug when converting gb2312, this is how to handle
Iconv ("Utf-8", "Gb2312//ignore", $str)
Mb_convert_encoding ()
PHP's internal code conversion function
Version (PHP 4 >= 4.0.6, PHP 5)
This function can convert various encodings to each other
Mb_convert_encoding ($str, "gb2312", "utf-8");
MySQL Tutorial _real_escape_string ()
Definition: A function escapes special characters in a string used in an SQL statement.
Syntax: mysql_real_escape_string (string,connection)
Description: This function escapes special characters in a string and takes into account the current character set of the connection, so it can be used safely for mysql_query ().
?>
http://www.bkjia.com/PHPjc/445422.html www.bkjia.com true http://www.bkjia.com/PHPjc/445422.html techarticle function Addslashes_str ($str) {$str =addslashes ($str) $str =str_replace ($str,;,;); return $str;} function Stripslashes_str ($str) {$str =stripslashes ($str); $str =str_replace ($str,;,;. ...