var_dump($array);
给出:
Array
(
[data] => Array
(
[0] => Array
(
[name] => Mark O'Donel
[id] => 35802624
)
[1] => Array
(
[name] => Da's Messager
[id] => 522505962
)
)
)
知道如何添加斜线来排列值吗?尝试以下但它不起作用:
foreach($array as $list){
foreach($list as $elt){
$name = $elt['name'];
$id = $elt['id'];
echo 'before: '. $name .'<br><br>'; // Assuming $name= "Mark O'Donel"
$list[$id] = addslashes($name);
echo 'after: '. $elt['name'] .'<br><br>'; //suppose to give Mark O\'Donel
}
}