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

传入变量保存下次使用

WBOY
Release: 2016-06-23 14:14:30
Original
1064 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template