Correction status:qualified
Teacher's comments:反斜线转义, 完全可以通过使用单引号来避免, 这类转义要慎用...
大量的转义不仅使代码可读性变差,出错率提升, 系统解析转义符还会增加系统开销, 除非不得已, 否则就不用
<?php include __DIR__."/inc/header.php"; foreach ($nav as $i){ echo "<div class=\"clear\"></div>"; echo "<div id=\"yewu\">"; echo "<div class=\"ititle\">{$i['nav_name']}</div>"; foreach ($nv_title as $ii) { if ($i['nav_id'] === $ii['nav_id']) { echo "<div class=\"yewu\">"; echo "<a class=\"yewu1\" href='notice.php?item_id=".$ii['id']."'>"; echo "<div class=\"yewuimg\"><img src=\"status/images/{$ii['dis_image']}\" width=\"63\" height=\"63\"></div>"; echo "<div class=\"yewup\">"; echo "<p class=\"yewup1\">".$ii['yewu_title']."</p>"; echo "<p class=\"yewup2\">".$ii['yewu_nr']."</p>"; echo "</div>"; echo "</a>"; } } } include __DIR__."/inc/footer.php";
点击 "运行实例" 按钮查看在线实例
<?php include __DIR__."/inc/header.php"; $id = $_GET['id']; $cate_id = intval($id); foreach ($nav as $i){ if ($i['nav_id']===$cate_id){ echo "<div class=\"clear\"></div>"; echo "<div id=\"yewu\">"; echo "<div class=\"ititle\">{$i['nav_name']}</div>"; foreach ($nv_title as $ii) { if ($i['nav_id'] === $ii['nav_id']) { echo "<div class=\"yewu\">"; echo "<a class=\"yewu1\" href='notice.php?item_id=" . $ii['id'] . "'>"; echo "<div class=\"yewuimg\"><img src=\"status/images/{$ii['dis_image']}\" width=\"63\" height=\"63\"></div>"; echo "<div class=\"yewup\">"; echo "<p class=\"yewup1\">" . $ii['yewu_title'] . "</p>"; echo "<p class=\"yewup2\">" . $ii['yewu_nr'] . "</p>"; echo "</div>"; echo "</a>"; } } } } include __DIR__."/inc/footer.php";
点击 "运行实例" 按钮查看在线实例
<?php include __DIR__."/inc/header.php"; $id = $_GET['item_id']; $item_id = intval($id); foreach ($nv_title as $i){ if ($i['id']===$item_id){ echo "<h3>{$i['yewu_title']}</h3>"; echo '<img src="status/images/'.$i['dis_image'].'" alt="" width="300">'; echo "<p style='text-indent: 2em'>{$i['yewu_nr']}</p>"; } } include __DIR__."/inc/footer.php";
点击 "运行实例" 按钮查看在线实例
<?php $setting =[ 'title'=>'狗子的课堂作业', 'copy' =>'乐道网络', 'beian'=>'鲁XXXXX' ]; $nav =[ [ 'nav_id' => 1, 'nav_name' => '关于乐道', 'nav_cl' => 7 ], [ 'nav_id' => 2, 'nav_name' => '师资团队', 'nav_cl' => 2 ], [ 'nav_id' => 3, 'nav_name'=> '课程设置', 'nav_cl' => 3 ] ]; $bannan =[ [ 'image'=>'1.jpg', 'url'=>'http://php.cn' ], [ 'image'=>'2.jpg', 'url'=>'http://404.cn' ], ]; $nv_title=[ [ 'nav_id'=>1, 'dis_image'=>'yewu.png', 'yewu_title'=>'制作业务', 'yewu_nr'=>'制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务', 'id'=>1 ], [ 'nav_id'=>1, 'dis_image'=>'yewu.png', 'yewu_title'=>'开发业务', 'yewu_nr'=>'开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务', 'id'=>2 ], [ 'nav_id'=>1, 'dis_image'=>'yewu.png', 'yewu_title'=>'研发项目', 'yewu_nr'=>'研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目', 'id'=>3 ], [ 'nav_id'=>2, 'dis_image'=>'yewu.png', 'yewu_title'=>'制作业务', 'yewu_nr'=>'制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务', 'id'=>4 ], [ 'nav_id'=>2, 'dis_image'=>'yewu.png', 'yewu_title'=>'开发业务', 'yewu_nr'=>'开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务', 'id'=>5 ], [ 'nav_id'=>2, 'dis_image'=>'yewu.png', 'yewu_title'=>'研发项目', 'yewu_nr'=>'研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目', 'id'=>6 ], [ 'nav_id'=>3, 'dis_image'=>'yewu.png', 'yewu_title'=>'制作业务', 'yewu_nr'=>'制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务制作业务', 'id'=>7 ], [ 'nav_id'=>3, 'dis_image'=>'yewu.png', 'yewu_title'=>'开发业务', 'yewu_nr'=>'开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务开发业务', 'id'=>8 ], [ 'nav_id'=>3, 'dis_image'=>'yewu.png', 'yewu_title'=>'研发项目', 'yewu_nr'=>'研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目研发项目', 'id'=>9 ] ]; //]; //]; //$news =[ // [ // 'nav_id'=>2, // 'dis_image'=>'news.jpg', // 'yewu_nr'=>'融汇深圳设计・服务中国创造”深圳市商业美术设计促进会', // 'news_id'=>1, // 'clss_id'=>1 // // ], // [ // 'nav_id'=>2, // 'dis_image'=>'news.jpg', // 'yewu_nr'=>'融汇深圳设计2・服务中国创造”深圳市商业美术设计促进会2', // 'news_id'=>2, // 'clss_id'=>2 // // ], // [ // 'nav_id'=>3, // 'dis_image'=>'news.jpg', // 'yewu_nr'=>'融汇深圳设计3・服务中国创造”深圳市商业美术设计促进会3', // 'news_id'=>3, // 'clss_id'=>1 // ], // [ // 'nav_id'=>3, // 'dis_image'=>'news.jpg', // 'yewu_nr'=>'融汇深圳设计4・服务中国创造”深圳市商业美术设计促进会3', // 'news_id'=>4, // 'clss_id'=>2 // ], //]; ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title><?php echo $setting['title']?></title> <link rel="stylesheet" type="text/css" href="status/css/style.css" /> <script type="text/javascript" src="status/js/jquery1.42.min.js"></script> <script type="text/javascript" src="status/js/jquery.SuperSlide.2.1.1.js"></script> </head> <body> <div id="header"> <div class="header"> </div> </div> <div id="menu"> <div class="menu"> <ul id="nav" class="nav clearfix"> <li class="nLi color1"> <h3><a href="index.php" target="_blank">首页</a></h3> </li> <?php foreach ($nav as $ii): ?> <li class="nLi color<?php echo $ii['nav_cl']?>"> <h3><a href="<?php echo 'list.php?id='.$ii['nav_id']?>"><?php echo $ii['nav_name']?></a></h3> </li> <?php endforeach;?> </ul> </div> </div> <script id="jsID" type="text/javascript"> jQuery("#nav").slide({ type:"menu",// 效果类型,针对菜单/导航而引入的参数(默认slide) titCell:".nLi", //鼠标触发对象 targetCell:".sub", //titCell里面包含的要显示/消失的对象 effect:"slideDown", //targetCell下拉效果 delayTime:300 , //效果时间 triggerTime:0, //鼠标延迟触发时间(默认150) returnDefault:true //鼠标移走后返回默认状态,例如默认频道是“预告片”,鼠标移走后会返回“预告片”(默认false) }); </script> <div id="slideBox" class="slideBox"> <div class="bd"> <ul> <?php foreach ($bannan as $key):?> <li style="background:url(status/images/<?php echo $key['image']?>) no-repeat 50% 0;"><a href="<?php echo $key['url']?>" target="_blank"></a></li> <?php endforeach;?> </ul> </div> <!-- 下面是前/后按钮代码,如果不需要删除即可 --> <a class="prev" href="javascript:void(0)"></a> <a class="next" href="javascript:void(0)"></a> </div> <script type="text/javascript"> jQuery(".slideBox").slide({mainCell:".bd ul",effect:"fold",autoPlay:true}); </script>
点击 "运行实例" 按钮查看在线实例
<div class="copy-right"> <p><span style="color:#ed6d00"><?php echo $setting['copy']?></span> Copyright ©2015 ALL Rights Reserved 备案号:<?php echo $setting['beian']?> 建议使用1280X768以上分辨率浏览本站</p> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例