首先我们来说一下递归的思想
我的理解是,递归是一部分通用方法的复用。就是如果你不知道你的代码哪里可以用到递归,你可以看看你的代码有没有一部分结构一样但是完全重复的地方。
如果有,那我们就可以用递归方法来处理。
话不多说,我先摆上要处理的例子数组。
$childrens = [
array(
'title' => '1第一层',
'id' => '0.1',
'test' => 'test1',
'children' => [
array(
'title' => '1第二层',
'id' => '0.1.2',
'test' =>