问题:
get('module-'.SITE_ID.'-content'); foreach ($rt as $key => $value) { $module[] = $key; } $mod = implode(",",$module); var_dump ($mod); ?>
循环多个模块,以上运行结果输出模块名称 news,jsmk,zjmk
想要排除news模块,用unset($key['news']);
get('module-'.SITE_ID.'-content'); foreach ($rt as $key => $value) { unset($key['news']); //排除news $module[] = $key; } $mod = implode(",",$module); var_dump ($mod); ?>
但是报错,应该怎么修改下,才能排除news模块呢?
答案:
get('module-'.SITE_ID.'-content'); foreach ($rt as $key => $value) { if ($key != 'news') { $module[] = $key; } } $mod = implode(",",$module); var_dump ($mod);?>
补习一下php知识
@迅睿框架联合创始人:感谢,好用。