A field in my database is saved in this way, {code ...} I wrote a backup program, and the exported format is correct {code ...} however, after the program is used to import the data to the database, the content of this field changes. It should be PDO that removed & #039; and linefeed, which led to my data... A field in my database is saved in this way,
Array (1 => array (\ 'id \ '=> 1, \ 'name \' => \ 'test \ ', \ 'desc \' => NULL, \ 'url \ '=> \ 'HTTP: // 163.com \', \ 'parent \ '=> 0 ,),)
I wrote a backup program and the exported format is correct.
Insert into 'table' VALUES ('names', 'array (1 => array (\ 'id \ '=> 1, \ 'name \ '=> \ 'test \', \ 'desc \ '=> NULL, \ 'url \' => \ 'HTTP: // 163.com \', \ 'parent \ '=> 0,),)', 'key ');
However, after the program is imported into the database, the content of this field changes. It should be that PDO has removed \ 'and linefeed, as a result, my data cannot be used again...
Array (1 => array ('id' => 1, 'name' => 'test', 'desc' => NULL, 'url' => 'HTTP: // 163.com ', 'parent' => 0 ,),)
Yes. In some cases, I don't want to use serialize or unserialize.
Reply content:
A field in my database is saved in this way,
Array (1 => array (\ 'id \ '=> 1, \ 'name \' => \ 'test \ ', \ 'desc \' => NULL, \ 'url \ '=> \ 'HTTP: // 163.com \', \ 'parent \ '=> 0 ,),)
I wrote a backup program and the exported format is correct.
Insert into 'table' VALUES ('names', 'array (1 => array (\ 'id \ '=> 1, \ 'name \ '=> \ 'test \', \ 'desc \ '=> NULL, \ 'url \' => \ 'HTTP: // 163.com \', \ 'parent \ '=> 0,),)', 'key ');
However, after the program is imported into the database, the content of this field changes. It should be that PDO has removed \ 'and linefeed, as a result, my data cannot be used again...
Array (1 => array ('id' => 1, 'name' => 'test', 'desc' => NULL, 'url' => 'HTTP: // 163.com ', 'parent' => 0 ,),)
Yes. In some cases, I don't want to use serialize or unserialize.
Ha ha ha ha. It's just a string. Unless you eval, security and performance are not as good as serialization. You can format the json format.
The default exec and query operations of PDO do not support filtering. Use prepare