No more than 3 backslashes are allowed in json_encode output.
P粉561749334
P粉561749334 2023-08-08 21:02:30
0
1
550

I have a piece of code that handles a very large amount of data and converts it using json_encode (around 255,000 characters). But I noticed that each time json_encode returns no more than 3 backslashes in the result. Is this intentional, a bug, or something else?

 

When I use a script to convert a file to a directory, this happens:

(starting with: "hercher "Nom : Le mei") (after json_encode After: "hercher "Nom : Le mei"), I tried updating the PHP version, but nothing changed.


P粉561749334
P粉561749334

reply all (1)
P粉551084295

I didn't validate the function in PHP, but your JSON input is wrong.

JSON consists of key-value pairs, for example:


{"hercher Nom": "Le mei"}

Or multiple key-value pairs separated by commas:

{"hercher Nom": "Le mei", "hercher Nom 2": "Le mei 2"}

You can adjust the arrangement of the content slightly for readability, but this is not technically necessary:

{ "hercher Nom": "Le mei", "hercher Nom 2": "Le mei 2" }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!