This article describes the usage of functions related to special character escaping in php and describes how php can process special characters. For more information, see. Mysql and php come with many functions that can handle character issues. Below are some frequently used functions. ps: Since php6 does not support magic_quotes_gpc at the beginning, the following things are assumed to be in the condition of magic_quotes_gpc = off (I don't know what new things will happen to php6 ....) Mysql_real_escape_string () definition: function escape special characters in strings used in SQL statements. Syntax: mysql_real_escape_string (string, connection) Description: This function escapes special characters in string and considers the connected character set. Therefore, it can be safely used for mysql_query (). Because the instance code is too long, the function explanation link w3school phpnet is provided. Addslashes () 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. Because the instance code is too long, the function explanation link w3school phpnet function stripslashes () removes the backslash character. (Used to interpret characters to be filtered) Mb_convert_encoding () php internal code conversion function version (php 4> = 4.0.6, php 5) This function can convert various encodings related to phpnet Iconv () php internal code conversion function, same as above because of the bug in iconv () converting gb2312, so it is necessary to deal with php filtering special character practical function php form submission special character filtering method html special character filtering php class url link special character escaping method php special character escaping explanation php filter parameter special character php instance: example of special character processing functions |