你們好
我想做一個選單效果
要php判斷當前頁面後再顯示指定樣式的,
或者判斷後控制html某id的物件套用上css某個class
就如原理:
if (當前頁面==index.php) {
控制id="main" 套用class="xxx";
}elseif{
(當前頁面==about.php)
控制id="abc"的東西套用css class="xyz"
目標:

因為進入網頁第一頁就是index 所以選單上的index位就自然地被用上css了

這是頁面仍在index,所以index仍舊高亮,而main的高亮效果是css的a:hover(指著)

最後這個是因為進入了main那一頁,所以現在高亮的就是main了
而我的php網頁結構是
引入(header)
main
引入(footer)
即是每按一頁就是新的一頁,亦是引用同一個選單,所以需要判斷頁面句
實在不解,有望可以獲得有例子的答案,謝謝了