Home  >  Article  >  Backend Development  >  传入变量保存下次使用

传入变量保存下次使用

WBOY
WBOYOriginal
2016-06-23 14:14:30994browse

public function getTree($data ,$pId=0,$parentId='',$categoryId='',$categoryName='')
{
怎么把我传入的变量保存后,下次能直接使用我以前传入的变量


回复讨论(解决方案)

下次指的是?

public function getTree($data ,$pId=0,$parentId='',$categoryId='',$categoryName='')
{
$html='';
foreach ($data as $k=>$v)
{
if ($v["$parentId"]==$pId) 
{
//根据父id查找他下属

$html.=$this->getTree($data, $v["$categoryId"]);


}
}

$html.=$this-> getTree($data, $v["$categoryId"]);

SESSION

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn