【发布时间】:2021-10-17 00:03:15
【问题描述】:
我正在尝试使用 PHP 创建一个动态选项卡。请有人可以帮助我只需要过滤类别 parent = 0 的位置。
$parent_category_html.= '<span class="'.$current_tab.'"><a id="tab-'
. $category['id'].'-link" href="#tab-'.$category['id']
. '" role="tab" aria-selected="false" aria-controls="tab-1" class="tab-link">'
. **$category['title'] is it possible to put an if statement here to filter the title where parent = 0**
. '</a>
【问题讨论】:
-
你能解释一下你想要做什么吗?
-
“将 if 语句插入变量”或“过滤标题”是什么意思?
-
我要做的是插入 if 语句。在类别标题中过滤 where parent = 0 我认为这样 if($parent = 0){ $category['title'] }
-
@David 都插入过滤器
-
@D3vm4d:你的意思是如果
$parent == 0,你只想在结果字符串中包含$category['title']值?