后端开发|php教程
nbsp,gt,data,getkindcache,array
后端开发-php教程
请教一个多维数组递归查找问题
有个无限极分类的数据表
我把数据表分类,生成了多维数组进行保存
function getkind($id)
{
if(file_exists($_G[‘cache’].’kindcache.txt’)) //分类缓存是否存在
$str = unserialize(file_get_contents($_G[‘cache’].’kindcache.txt’));
else
$str = $cache->outkindcache(0); // 生成分类缓存
$data=$this->getkindcache($id,$str); //查找数组
return $data;
}
获取网站源码html,ubuntu运行exe软件,tomcat网页不安全,爬虫解析模板,php数据序列化,化学seolzw
function getkindcache($id,$str,$data1=array())//递归函数
{
global $_G;
foreach($str as $k=>$v)
{
if($v[‘kind’] == $id)
{
$data1[] = $v;
}
if(is_array($v[‘child’]))
$this->getkindcache($id,$v[‘child’],$data1);
qq登录e源码,树莓派移植ubuntu,任天堂labo爬虫,php 做库存,神马优化seolzw
}
return $data1;
}
上面的这个递归函数总是返回NULL,不能保存我要返回的数据
淘宝店铺源码,vscode文件筛选,苹果m1安装ubuntu,tomcat定时几点,qt sqlite时间类型,jquery弹出层插件下载,贝贝前端用什么框架,爬虫如何爬照片,php 获取最后一天,seo可以兼职的项目seo公司,单页营销网站源码下载,微信网页 资讯 spring,java 后台管理系统模板,兑换券自动连接小程序lzw
标红的是我要查找的数据
Array
(
[0] => Array
(
[uid] => 2
[kind] => 0
[top] => 2
[pagesize] => 15
[name] => 新闻
[sort] => 1
[keywords] =>
[description] =>
[enable] => 1
[html] => 1
[outlink] =>
[model] => news
[modelname] => 新闻模型
[template] => news.html
[templist] => news_list.html
[tempview] => news_view.html
[typedir] => http://localhost/-4-30/static/2