The JSON string that is uploaded to Php via Ajax is sometimes added with a backslash "\" to escape, and the PHP process needs to remove the backslash first and then Json_decode.
$str = stripslashes ($_post[' json '));
Ps:php get crawl JSON
The JSON string that is passed to PHP via Ajax is sometimes added with a backslash "\" to escape, and PHP needs to be stripped of the backslash before Json_decode.
ps:php get fetch JSON how to remove backslash before double quotation mark
Kankan OriginalThis format is required when sending data in the background with PHP.private void Sendjson () { Initializing a custom handlerCashhandler handler = new Cashhandler (this);Request the primary address, written in the custom application,
PHP array Conversion String function, I use thinkphp, Json_encode save Chinese, backslash disappeared
This is the original.
[{"title": "\u5173\u6ce8\u65f6\u56de\u590d", "url": "\/index.php?g=user****"}]
Turns out this is it.
[{"title": "u5173u6ce8u65
In JavaScript, there are two places where backslash escape sequences are used, one in string literals and one in regular literals. In the string literal, the backslash escape sequence is divided into the following forms:1. \ followed by single
The Addslashes function is primarily to escape the special character by adding a backslash to the string, and stripslashes to remove the backslash in the escaped string, such as when you submit a JSON data to the PHP side, you may encounter a \
Summary
JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data exchange format. It is derived from the ecmascript language standard. JSON defines a small set of formatting rules for lightweight representation of
PHP removes backslashes in JSON string and backslash before double quotation mark, JSON double quotation mark
The JSON string that is passed to PHP via Ajax is sometimes added with a backslash "\" to escape, and PHP needs to be stripped of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.