<? Nl2br (); // to <br/>
Addslashes (); strips tutorial lashes (); // Escape Special characters when operating on the database tutorial
Definition: The addslashes () function adds a backslash before a specified predefined character.
Syntax: addslashes (string)
Note: By default, the magic_quotes_gpc command of php is on, and addslashes () is automatically run for all get, post, and cookie data (). Do not use addslashes () for strings that have been escaped by magic_quotes_gpc, because this causes double-layer escape. In this case, you can use the get_magic_quotes_gpc () function for detection.
<? Php
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 of the string
Trim (); // remove all spaces in the string
Ltrim (); // remove the left space of the string
Htmlspecialchars (); // converts '$', '"', '<', '>' to the corresponding html entity
Htmlentities (); // Convert all html tags to corresponding html entities
Array explode (string separator, string str); // splits the string
String implode (string separator, array arr); // connection string
Strtoupper (); strtolower (); // converts the case sensitivity
Ucfirst (); // only converts the first character to uppercase.
Ucwords (); // converts the first letter of each word to uppercase.
Iconv ()
Php internal code conversion function, same as above
Because iconv () is a bug in gb2312 conversion, it should be handled like this
Iconv ("UTF-8", "gb2312 // ignore", $ str)
Mb_convert_encoding ()
Php 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: Special characters in strings used in function escape SQL statements.
Syntax: mysql_real_escape_string (string, connection)
Note: This function escapes special characters in string and considers the current character set to be connected. Therefore, it can be safely used for mysql_query ().
?>