【发布时间】:2021-01-21 17:23:23
【问题描述】:
亲爱的,我想请你帮忙格式化 PHP 代码。 因为 W3C 验证器,所以将其作为错误返回给我,“错误:重复属性类。” 我现在有下一个 PHP 代码:
$html .= '<a href="'.$href.'"';
if($this->hasChilds($item, $nazev)) $html .= ' class="qmparent"';
if ((empty($view) && $item->view == 'main') || (empty($display) && $view == $item->view) || (!empty($display) && $display == $item->display)) $html .= ' class="active"';
$html .= '>';
这给了我 html
代码:<a href="link.html" class="qmparent" class="active">LINK</a>
我想,可以生成,
不同的 html
代码:<a href="link.html" class="qmparent active" >LINK</a>
能否请教一下,如何改写?我不知道它是否足以正确理解,如果没有,我会添加很多代码。谢谢!
【问题讨论】: