Correction status:Uncorrected
Teacher's comments:
<?php include __DIR__. '/public/include/header.php'; foreach($cates as $cate){ echo "<h2>{$cate['alias']}</h2>"; echo '<ol>'; foreach($movies as $movie){ if($cate['cate_id'] === $movie['cate_id']){ echo "<li><a href='detail.php?mov_id=".$movie['mov_id']."'>{$movie['name']}</a></li>"; } } echo '</ol>'; } include __DIR__ . '/public/include/footer.php'; ?>
点击 "运行实例" 按钮查看在线实例
<?php include __DIR__. '/public/include/header.php'; $mov_id = $_GET['mov_id']; $mov_id = (int)$mov_id; foreach($movies as $movie){ if($movie['mov_id'] === $mov_id){ echo "<h3>{$movie['name']}</h3>"; echo '<img src="public/static/images/'.$movie['image'].'" width="300">'; echo "<p>{$movie['detail']}</p>"; } } include __DIR__ . '/public/include/footer.php'; ?>
点击 "运行实例" 按钮查看在线实例
<?php include __DIR__. '/public/include/header.php'; $cate_id = $_GET['cate_id']; $cate_id = (int)$cate_id; foreach($cates as $cate){ if($cate['cate_id'] === $cate_id){ echo "<h2>{$cate['alias']}</h2>"; echo '<ol>'; foreach($movies as $movie){ if($cate['cate_id'] === $movie['cate_id']){ echo "<li><a href='detail.php?mov_id=".$movie['mov_id']."'>{$movie['name']}</a></li>"; } } echo '</ol>'; } } include __DIR__ . '/public/include/footer.php'; ?>
点击 "运行实例" 按钮查看在线实例