php的一些技巧

1.phpEdit保存时偶尔出错,原因是:建立工程文件的路径要用全英文..

2.php写一个无限分类示例

Technorati 标签:

//无限分类
    function GetList($examCateID=0){
        $result=    $this->AddTree($examCateID,'');
        //dump($result);
        return $result;
    }

    function AddTree($examCateID,$sbar){
        static $result = array();
        $olist = D("ExamCate")->order("ExamCateOrderNum")->where("ExamCateFID=$examCateID")->findAll();

        if(is_array($olist)){
            for ($i = 0; $i < count($olist); $i++) {
                $olist[$i]["ExamCateName"] = $sbar.$olist[$i]["ExamCateName"] ;
                array_push($result,$olist[$i]);
                $this->AddTree($olist[$i]["ExamCateID"],"├─");
            }
        }
        return $result;

    }

原文地址:https://www.cnblogs.com/zq535228/p/1294524.html