💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 面包屑制作 ``` function sp_get_path($cid, $title=""){ $term = sp_get_term($cid); $html="<ul class=\"breadcrumb\"> <li><a href=\"__ROOT__\">首页</a> <span class=\"divider\">/</span></li>"; $parent = sp_get_term($term['parent']); if($parent){ $url=UU('portal/list/index',array(id=>$term['parent'])); $html.="<li><a href=\"$url\">${parent['name']}</a> <span class=\"divider\">/</span></li>"; } if(empty($title)){ $html.="<li class=\"active\">${term['name']}</li></ul>"; }else{ $url=UU('portal/list/index',array(id=>$cid)); $html.="<li><a href=\"$url\">${term['name']}</a><span class=\"divider\">/</span></li>"; $html.="<li class=\"active\">$title</li></ul>"; } echo $html; } ``` ##使用方法, 列表页中`{:sp_get_path($cat_id)}` 文章页中`{:sp_get_path($term['term_id'], $post_title)}` 如图所示: ![](https://box.kancloud.cn/2016-09-02_57c8ddd380bc9.png)