php array用法,实例教程
<?php /* 后台管理框架配置 author:xqbar datetime:2008-3-29 */ $toplink = array( 0 => '账号管理', '新闻管理', '店铺管理', '系统管理', '友情链接' ); $leftnav = array( 0 => '账号管理|退出系统', '新闻管理|新闻分类|退出系统', '店铺管理|店铺分类|模板管理|退出系统', '分类管理|地域管理|模板管理|退出系统', '友情链接|退出系统' ); $leftlink = array( 0 => '<a href="test/test.php" target="mainFrame">管理员</a> <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> <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> <a href="test/test.php" target="mainFrame">添加店铺</a>|<a href="class/test.php" target="mainFrame">店铺分类</a>|<a href="test/test.php" target="mainFrame">模板列表</a> <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> <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="test/test.php" target="mainFrame">添加模板</a>|<a href="checklogin.php?logout=ok" target="_top">退出管理</a>', '<a href="test/test.php" target="mainFrame">连接列表</a> <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']); }
教程网址:http://www.phprm.com/code/d995697aed8ed1964988a25b0ef3adbd.html
欢迎收藏∩_∩但请保留本文链接。