我的菜单中有很多li
<li class="<?php if($this->uri->segment(1)=='user'|| 'role'|| 'sections' || 'actions') {echo 'active open';} else {echo 'noactive';} ?>">
即使控制器名称不在url中,它始终处于打开阶段,因此任何建议
答案 0 :(得分:1)
你的病情不对。试试这个
<li class="<?php if(($this->uri->segment(1) == 'user') || ($this->uri->segment(1) == 'role') || ($this->uri->segment(1) == 'sections') || ($this->uri->segment(1) == 'actions')) {echo 'active open';} else {echo 'noactive';} ?>">