You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
427 B
PHTML

2 years ago
<?php
namespace Media\Model;
use Think\Model;
/**
* 插件模型
*/
class SlidemanageModel extends Model {
protected $_validate = array(
);
//获取树的根到子节点的路径
public function getPath($id){
$path = array();
$nav = $this->where("id={$id}")->field('id,pid,title')->find();
$path[] = $nav;
if($nav['pid'] >1){
$path = array_merge($this->getPath($nav['pid']),$path);
}
return $path;
}
}