There are a lot of backslashes in the data stored in json format in Navicat for mysql. How to remove them?
巴扎黑2017-06-06 09:52:07
0
3
1486
When using mysql's json operation, it will be interfered by escape characters. It is normal to read it. I want to save it in the database without these backslashes
Adding a backslash is for safety reasons, so it is best to add it. thinkphp's I method has data filtering. If you remove the filtering, there will be no backslashes.
You can separate the json data and store it in different fields
Or use serialize() to serialize the json data and store it, and then unserialize() it when taking it out
Visually, there is a problem with your storage. What you store is an array of strings, not an array of josn objects
Visually, it is related to the serialization library (or class) you are using. Let’s debug it with breakpoints before importing it into the library.
Adding a backslash is for safety reasons, so it is best to add it. thinkphp's I method has data filtering. If you remove the filtering, there will be no backslashes.
You can separate the json data and store it in different fields
Or use serialize() to serialize the json data and store it, and then unserialize() it when taking it out