<li><a class="<?php if($_GET['q']=='addons.html');echo 'current';?>" href="addons.html">test</a></li>
<li><a class="<?php if($_GET['q']=='technicalsupport.html');echo 'current';?>" href="technicalsupport.html">example</a></li>
<li><a class="<?php if($_GET['q']=='center.html');echo 'current';?>" href="center.html">center</a></li>
<li><a class="<?php if($_GET['q']=='about.html');echo 'current';?>" href="about.html">about</a></li>
爲什麼這些都是添加「當前」當前頁面?我想你的if
語句的結束)
後到class="current"
僅添加到當前頁面我的php代碼有什麼問題?
謝謝你,我太不小心了! – zhuanzhou 2011-05-25 05:34:55
+1 @ bradley.ayers :) welll – Harsh 2011-05-25 05:36:26
我會重新考慮這一點,因爲它只是創造了很多重複的代碼。看看我的例子,下面是一個功能包裝的解決方案,更短,更清潔的重用。 – Jakub 2011-05-26 15:05:30