Heim >Backend-Entwicklung >PHP-Tutorial > 数据的格式话有关问题
求教:数据的格式话问题
数据源格式:
<br /> $data = array(<br /> array('id' => 1,'pid' => 0,'name' => 'a'),<br /> array('id' => 2,'pid' => 0,'name' => 'b'),<br /> array('id' => 3,'pid' => 1,'name' => 'c'),<br /> array('id' => 4,'pid' => 1,'name' => 'd'),<br /> array('id' => 5,'pid' => 3,'name' => 'e'),<br /> array('id' => 6,'pid' => 3,'name' => 'f'),<br /> array('id' => 7,'pid' => 6,'name' => 'g'),<br /> array('id' => 8,'pid' => 6,'name' => 'h'),<br /> array('id' => 9,'pid' => 8,'name' => 'i'),<br /> array('id' => 10,'pid' => 8,'name' => 'j'),<br /> array('id' => 11,'pid' => 9,'name' => 'l'),<br /> array('id' => 12,'pid' => 9,'name' => 'm'),<br /> );<br />
<?php <br /> $data = array(<br> array('id' => 1,'pid' => 0,'name' => 'a'),<br> array('id' => 2,'pid' => 0,'name' => 'b'),<br> array('id' => 3,'pid' => 1,'name' => 'c'),<br> array('id' => 4,'pid' => 1,'name' => 'd'),<br> array('id' => 5,'pid' => 3,'name' => 'e'),<br> array('id' => 6,'pid' => 3,'name' => 'f'),<br> array('id' => 7,'pid' => 6,'name' => 'g'),<br> array('id' => 8,'pid' => 6,'name' => 'h'),<br> array('id' => 9,'pid' => 8,'name' => 'i'),<br> array('id' => 10,'pid' => 8,'name' => 'j'),<br> array('id' => 11,'pid' => 9,'name' => 'l'),<br> array('id' => 12,'pid' => 9,'name' => 'm'),<br> );<br> /********我是YD的分割线*************/<br> $pid = 1000000;<br> //$mark = 'c';<br> foreach ($data as $key => $value){<br> <br> if ($value[pid] == $pid) { <div class="clear"> </div>