The PHPjson string is used to process special characters (single quotation marks, double quotation marks ). PHP json string processing of special characters (single quotation marks, double quotation marks) Preface: form forms use POST, GET, and other methods to submit data to the background, the background uses PHP to receive submitted data contains, (double quotation marks, PHP json string processing of special characters (single quotation marks, double quotation marks)
Form forms are submitted to the background using POST, GET, and other methods, and received by PHP in the background.
The submitted data contains "", "", "\" (double quotation marks, single quotation marks, and backslash), and the new PHP version (magic_quotes_gpc in php. when ini is set to ON, the addslashes () is automatically escaped. 5.3 discard, 5.4 remove, all need to use addslashes () for escape) all need to use addslashes () to add escape.
The data submitted from the form accepted by PHP must be escaped with stripcslashes (), escaped with addslashes (), and inserted into the database.
Use addslashes () to escape the data stored in the database. after the data is obtained, use stripcslashes () to escape the data and use json_encode () to convert the data to json format, use addslashes () to escape and return it to js for js processing.
Note: json_decode (string, true) converts the parsed data to an array in this way. if the value is not true, it is converted to an object. The default value is false.
Http://www.bkjia.com/PHPjc/1060169.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1060169.htmlTechArticlePHP json string special character processing (single quotes, double quotes ,, \ (double quotation marks ,...