PHP development classification technology drop-down menu classification (2)
We first define a function getList, parent class pid=0;
Use SQL statements to query subclasses.
Put the queried subclasses out through a while loop, and then add the "| -- " style,
Recursion is the technique of the function itself calling itself. When querying subclasses, we need to call getList($row['id']);
The ID of the subclass should be used as the ID of the next level, so $row['id']) needs to be brought in later
Then print_r to print the output style.