I want a thinkphp classification method, using a string to upload to the template
Public Function _getmenu ($id =0, $t =0) {
$category = M ("category");
$data = $category->where ("pid= $id")->order ("sort ASC")->select ();
if ($data) {
$t + +;
$data 2[' leavel ') = $t;
$category->where ("pid= $id")->save ($data 2);//Hierarchy
foreach ($data as $key = = $value) {
$sort = $value [' sort '];
$id = $value [' id '];
$this->str. = '';
$this->str. = "". $value [' id ']. "";
if ($t >1) {
if ()
$this->str. = "|-----". $value [' name ']. "";
}else{
$this->str. = "". $value [' name ']. "";
}
$this->str. = "". $value [' group ']. "";
$id = $value [' id '];
$this->str. = ' delete ';
$this->_getmenu ($value [' id '], $t);
}
}
}
------Solution--------------------
Then you have to judge whether all the columns under the current parent class are equal to the position of this column (the first few), and if they are equal, the last one will satisfy your request.
------Solution--------------------
The categorical array is $data
End ($DATA);
$ek = key ($data); The key value in the $data after a classification
Join in the Loop
if ($key = = $ek) $this->str. = "
------Solution--------------------
____ ". $value [' name ']."";