The specific code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function recursiveAssort( $assortPid , $tag = '' )
{
$assort = M( 'goods_class' )->where( "class_pid = $assortPid" )->field( 'class_id, class_name' )->select();
foreach ( $assort as $value ) {
$tree .= '<option value="' . $value [ 'class_id' ] . '">' . $tag . $value [ 'class_name' ] . '</option>' ;
$tree .= recursiveAssort( $value [ 'class_id' ], $tag . ' ' );
}
return $tree ;
}
|
Copy after login
The above code is all about using ThinkPHP to implement recursive stepless classification. I hope you like it.