There's a field in my database that's saved,
array ( 1 => array ( \'id\' => 1, \'name\' => \'测试\', \'desc\' => NULL, \'url\' => \'http://163.com\', \'parent\' => 0, ),)
Write a backup of the program, export the format is not wrong
INSERT INTO `table` VALUES('names','array ( 1 => array ( \'id\' => 1, \'name\' => \'测试\', \'desc\' => NULL, \'url\' => \'http://163.com\', \'parent\' => 0, ), )','key');
However, after the program was imported into the database, the contents of this field changed, it should be PDO to remove the \ ', also removed the line break, resulting in my data can not be used again ...
array ( 1 => array ( 'id' => 1, 'name' => '测试', 'desc' => NULL, 'url' => 'http://163.com', 'parent' => 0, ),)
Well, because of some circumstances, I don't want to use serialize and unserialize.
Reply content:
There's a field in my database that's saved,
array ( 1 => array ( \'id\' => 1, \'name\' => \'测试\', \'desc\' => NULL, \'url\' => \'http://163.com\', \'parent\' => 0, ),)
Write a backup of the program, export the format is not wrong
INSERT INTO `table` VALUES('names','array ( 1 => array ( \'id\' => 1, \'name\' => \'测试\', \'desc\' => NULL, \'url\' => \'http://163.com\', \'parent\' => 0, ), )','key');
However, after the program was imported into the database, the contents of this field changed, it should be PDO to remove the \ ', also removed the line break, resulting in my data can not be used again ...
array ( 1 => array ( 'id' => 1, 'name' => '测试', 'desc' => NULL, 'url' => 'http://163.com', 'parent' => 0, ),)
Well, because of some circumstances, I don't want to use serialize and unserialize.
Oh oh ha ha ha ha ha Oh, first of all, you appear to have directly stored the array in, actually take out to simply can not use. It's just a string. Unless you eval, security and performance are not as serializable. Even if your JSON format is OK.
The default exec and query for PDO does not support filtering. Please use prepare