这是我的带有选项的菜单的 PHP 代码。它有错误,请帮助我。
代码
<?php
$page_url = array();
$page_url[0]= "/bookslibrary.net/index.php";
$page_url[1]= "/bookslibrary.net/about.php";
$page_url[2]= "#";
$page_url[3]= "/bookslibrary.net/become-member.php";
$page_url[4]= "#";
$page_url[5]= "/bookslibrary.net/contact.php";
$page_urlActive = array();
$css_active = "class='active'";
switch ($_SERVER['PHP_SELF'])
{
case $page_url[0]: $page_urlActive[0] = $css_active; break;
case $page_url[1]: $page_urlActive[1] = $css_active; break;
case $page_url[2]: $page_urlActive[2] = $css_active; break;
case $page_url[3]: $page_urlActive[3] = $css_active; break;
case $page_url[4]: $page_urlActive[4] = $css_active; break;
case $page_url[5]: $page_urlActive[5] = $css_active; break;
} echo ("
<li $page_urlActive[0] ><a href='".$page_url[0]."'>Home</a></li>
<li $page_urlActive[1] ><a href='".$page_url[1]."'>About</a></li>
<li $page_urlActive[2] ><a href='".$page_url[2]."'>Books of the Month</a></li>
<li $page_urlActive[3] ><a href='".$page_url[3]."'>Become a Member</a></li>
<li $page_urlActive[4] ><a href='".$page_url[4]."'>Ahlus-Sunnah</a>
<ul>
<li><a href='#'>Web Directory</a></li>
<li><a href='#'>Add Your Website</a></li>
</ul>
</li>
<li $page_urlActive[5] ><a href='".$page_url[5]."'>Contact</a></li>
");
?>
错误
注意:未定义的偏移量:第 34 行 (...FILE_PATH...)header.php 中的 1