PHP JSON string to special character processing (single quotation marks, double quotes)
Preface: Form form Post,get and so on to submit data to the background, the background with PHP to receive the submitted data contains "" "," "", "\" (double quotes, single quotes, backslashes), the new version of PHP (MAGIC_QUOTES_GPC when the php.ini is set to ON, Automatic addslashes () is escaped. 5.3 Obsolete, 5.4 removal, all need to be escaped with addslashes (), you need to add escape with addslashes (). PHP accepts the form form submitted by the data, you need to escape with stripcslashes () after escaping with Addslashes (), and then insert the database. Use Addslashes () to escape the data stored in the database, take out, the same: need to be escaped with stripcslashes (), and then use Json_encode () to convert the required data to JSON format, and then escape with Addslashes () back to JS, Let JS processing. Note: Json_decode (string,true) is converted to an object form in this way directly to the data to be parsed, and not later to true. Default is False
http://www.bkjia.com/PHPjc/1060169.html www.bkjia.com true http://www.bkjia.com/PHPjc/1060169.html techarticle PHP JSON string to special character processing (single quotation mark, double quotation mark) Preface: Form table is submitted data to backstage with Post,get and so on, background with PHP to receive submitted data contains,, \ (double quotes, ... )