PHP development classification technology connection navigation style classification
In this section we will create a similar link navigation style
For example: Pictures>>Car Pictures>>Mercedes-Benz Pictures>>Mercedes-Benz C260 Pictures.
Creating databases and tables has been explained in the previous chapters, and will not be explained in detail in this section.
The idea is basically the same as the drop-down menu in the previous chapter:
Create the getCatePath function and execute SQL The statement queries the id. Through the queried id, different numbers of navigations can be displayed by entering different id values.
Use the custom function getCatePath to reverse the output using the krsort function.
By creating the displayCatePath function, use a foreach loop to output and add the ">>" style
$val) { $str.= ">{$val['title']}>"; } return $str; } echo displayCatePath(7); //输出当前的id为7 ?>