时间:2021-07-01 10:21:17 帮助过:2人阅读
[0] => Array ( [v] => 1 [fup] => 0 [n] => 服务器 [s] => Array ( [0] => Array ( [v] => 2 [fup] => 2 [n] => one [s] => Array ( [0] => Array ( [v] => 3 [fup] => 41 [n] => one ) [1] => Array ( [v] => 4 [fup] => 1 [n] => two ) [2] => Array ( [v] => 5 [fup] => 1 [n] => three ) ) ) [1] => Array ( [v] => 42 [fup] => 2 [n] => two [s] => Array ( [0] => Array ( [v] => 73 [fup] => 42 [n] => one ) [1] => Array ( [v] => 74 [fup] => 42 [n] => two ) [2] => Array ( [v] => 75 [fup] => 42 [n] => three ) ) ) [2] => Array ( [v] => 43 [fup] => 2 [n] => three ) ) )
是删掉所有的 fup 项吗?递归呀!
$ar = 你的数组;foo($ar);function foo(&$ar) { foreach($ar as &$r) { if(isset($r['fup'])) unset($r['fup']); if(isset($r['s'])) foo($r['s']); }}
是删掉所有的 fup 项吗?递归呀!
$ar = 你的数组;foo($ar);function foo(&$ar) { foreach($ar as &$r) { if(isset($r['fup'])) unset($r['fup']); if(isset($r['s'])) foo($r['s']); }}
谢谢大神,试出来了
你打印出来看呀!你主贴中的不是你打印出来的吗?