2019独角兽企业重金招聘Python工程师标准>>>
数组格式要求 id => pid
$columns= [
'1' => 0,
'10' => 1,
'200' => 10
];
public function getP($columns,$pid)
{
模拟 $pid = 200;
$arr = $columns;
while($arr[$pid]) {
$pid= $arr[$pid];
}
return $pid; //找到1
}