PHP 클래스 Cml\Vendor\Tree

파일 보기 프로젝트 열기: linhecheng/cmlphp 1 사용 예제들

공개 메소드들

메소드 설명
getChild ( array $list, integer $id ) : string | array 获取子集
getParent ( array $list, integer $id ) : string | array 获取父集
getTree ( array $list, integer $pid, integer $selectedId, string $str = "<option value='$id' $selected>$tempPrefix$name</option>", string $prefix = '|--', string $selectedString = 'selected' ) : string | array 获取树--返回格式化后的数据
getTreeNoFormat ( array &$list, integer $pid ) : string | array 获取树--返回数组
setConfig ( array $config = [] ) : mixed 修改配置

메소드 상세

getChild() 공개 정적인 메소드

获取子集
public static getChild ( array $list, integer $id ) : string | array
$list array 树的数组
$id integer 父类ID
리턴 string | array

getParent() 공개 정적인 메소드

获取父集
public static getParent ( array $list, integer $id ) : string | array
$list array 树的数组
$id integer 子集ID
리턴 string | array

getTree() 공개 정적인 메소드

获取树--返回格式化后的数据
public static getTree ( array $list, integer $pid, integer $selectedId, string $str = "<option value='$id' $selected>$tempPrefix$name</option>", string $prefix = '|--', string $selectedString = 'selected' ) : string | array
$list array 数据列表数组
$pid integer 初始化树时候,代表获取pid下的所有子集
$selectedId integer 选中的ID值
$str string 组装后的字串
$prefix string 前缀
$selectedString string 选中时的字串 如selected checked
리턴 string | array

getTreeNoFormat() 공개 정적인 메소드

获取树--返回数组
public static getTreeNoFormat ( array &$list, integer $pid ) : string | array
$list array 数据列表数组
$pid integer 初始化树时候,代表获取pid下的所有子集
리턴 string | array

setConfig() 공개 정적인 메소드

修改配置
public static setConfig ( array $config = [] ) : mixed
$config array ['pid'=>'', 'id' => '', 'name' =>'name']
리턴 mixed