我想从几种不同的格式中反序列化一个字符串。第一种格式是json。
$myObj = new myObject();
$unserialized = json_decode($input, true);
foreach ($unserialized as $member_name => $value){
$myObj[$member_name] = $value; // <= How do I do what this is trying to do?
}
我想从几种不同的格式中反序列化一个字符串。第一种格式是json。
$myObj = new myObject();
$unserialized = json_decode($input, true);
foreach ($unserialized as $member_name => $value){
$myObj[$member_name] = $value; // <= How do I do what this is trying to do?
}