反复看了几遍视频了。也跟着练习了动手,但是就是不会用循环写出来评论。我自己结合写的应该是错误的。希望老师明确指出我的错误地方。
实例
<?php // 加载公共头部 include __DIR__ . '/header.php'; $mov_id = intval($_GET['mov_id']); // 复制list.php模板直接修改 foreach ($movies as $movie) { if ($movie['mov_id'] === $mov_id) { echo "<h3>{$movie['name']}</h3>"; echo '<img src="../9192/static/images/'.$movie['image'].'" alt="" width="300">'; echo "<p style='text-indent: 2em'>{$movie['detail']}</p>"; } }; $arr = [ 'biaoti' => '全部评论', 'date' => '2019.08.17 17:55:32', 'pinglun' => [ 'name' => '张三', 'neirong' => '这种爱情也只有电视中才会出现' ] ]; ?> <form> <table> <th style="float: left"><?php echo $arr['biaoti'] ?></th> <tbody> <tr> <td style="padding: 5px 10px"> <?php echo $arr['date']; ?> </td> <br> </tr> <tr> <td style="padding: 5px 10px"> <?php echo $arr['pinglun']['name']; ?> : <?php echo $arr['pinglun']['neirong']; ?></td> <br> </tr> <tr> <td style="padding: 5px 10px"> <textarea class="txt-commit" replyid="0"></textarea></td> </tr> <td> <button style="float: right">发表评论</button> </td> <tbody> </table> </form>
运行实例 »
点击 "运行实例" 按钮查看在线实例