php array用法,執行個體教程

來源:互聯網
上載者:User

<?php
/*
  後台管理架構配置
  author:xqbar
  datetime:2008-3-29
*/
$toplink=array(0=>'帳號管理','新聞管理','店鋪管理','系統管理','友情連結');
$leftnav=array(
                0=>'帳號管理|退出系統',
                   '新聞管理|新聞分類|退出系統',
                   '店鋪管理|店鋪分類|範本管理員|退出系統',
                   '分類管理|地區管理|範本管理員|退出系統',
                   '友情連結|退出系統'
               );
$leftlink=array(
                0=>'<a href="test/test.php" target="mainFrame">管理員</a>&nbsp;<a href="test/test.php" target="mainFrame">店鋪會員</a>|<a href="checklogin.php?logout=ok" target="_top">退出管理</a>',
                   '<a href="test/test.php" target="mainFrame">所有新聞</a>&nbsp;<a href="test/test.php" target="mainFrame">添加新聞</a>@<a href="test/test.php" target="mainFrame">組建檔案</a>|<a href="test/test.php" target="mainFrame">資訊分類</a>|<a href="checklogin.php" target="_top">退出管理</a>',
                   '<a href="test/test.php" target="mainFrame">所有店鋪</a>&nbsp;<a href="test/test.php" target="mainFrame">添加店鋪</a>|<a href="class/test.php" target="mainFrame">店鋪分類</a>|<a href="test/test.php" target="mainFrame">模板列表</a>&nbsp;<a href="class/mbadd.php" target="mainFrame">添加模板</a>|<a href="checklogin.php?logout=ok" target="_top">退出管理</a>',
                   '<a href="test/test.php" target="mainFrame">新聞分類</a>&nbsp;<a href="test/test.php" target="mainFrame">店鋪分類</a>|<a href="test/test.php" target="mainFrame">地區管理</a>|<a href="test/test.php" target="mainFrame">模板列表</a>&nbsp;<a href="test/test.php" target="mainFrame">添加模板</a>|<a href="checklogin.php?logout=ok" target="_top">退出管理</a>',
                   '<a href="test/test.php" target="mainFrame">串連列表</a>&nbsp;<a href="test/test.php" target="mainFrame">添加串連</a>|<a href="checklogin.php?logout=ok" target="_top">退出管理</a>'
               );                  
function topnav()
{
 global $toplink;
 $itemnum=count($toplink);
 echo '<div id="admin_header">';
 echo '<div id="admin_logo"></div>';
 echo '<div id="admin_nav">';
    echo '<ul>';
 foreach ($toplink as $key=>$value){echo "<li id='navli{$key}'><a href='javascript:navBar({$key},{$itemnum});'>$value</a></li>";}
 echo '</ul>';
 echo '</div>';
 echo '</div>';
 echo '</div>';
}
function leftnav($itemid)
{
 global $leftnav,$leftlink;
 $navtitle=explode('|',$leftnav[$itemid]);
 $navlink=explode('|',$leftlink[$itemid]);
 echo "<div id='admin_left'>";
 foreach ($navtitle as $key=>$value)
 {
  echo "<div class='navlist'>";
  echo "<h1 id='navtitle{$key}'><a href='javascript:nav({$key})'>{$value}</a></h1>";
  echo "<ul id='navlist{$key}'>";
  if(strlen(strstr($navlink[$key],"@"))>0){
   $itemlink=explode('@',$navlink[$key]);
   foreach($itemlink as $link){echo "<li>{$link}</li>";}
  }else{echo "<li>$navlink[$key]</li>";}
  echo "</ul>";
  echo "</div>";
 }
 echo "</div>";
}
if(isset($_GET['cpp'])){
 leftnav($_GET['cpp']);
}
?>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.