'a','con'=>'b');$b[] = $a;var_dump($b);echo '';$aa[]['son2'] = array('name' =>'a','con'=>'b');var_dump($aa);exit;*/header('Content-type:text/html;charset=UTF-8');mysql_connect('localhost', 'root', '123');mysql_select_db('wordpress');mysql_query('set names utf8');$sql = 'select * from emlog_comment where gid = 1';$rs = mysql_query($sql);$categories = array();while ($row = mysql_fetch_array($rs)) { $categories[] = $row;}$tree = show_comment($categories, 0);var_dump($tree);echo procHtml($tree);function show_comment($categories, $pid) { $array = ''; foreach($categories as $category) { if ($pid == $category['pid']) { $category['son'] = show_comment($categories, $category['cid']); $array[] = $category; } } return $array;}function procHtml($tree){$html = '';foreach($tree as $t){ if($t['son'] == '') { $html .= "
- '.$html.'
- '.$html.'