test.php
<?phpheader("Content-type:text/html;charset='utf8'");error_reporting(E_ALL);echo "模拟数据库常用操作效果<br>";echo "<a href='check.php?action=add'>执行增加操作</a><br>";echo "<a href='check.php?action=del'>执行删除操作</a><br>";echo "<a href='check.php?action=search'>执行查找操作</a><br>";echo "<a href='check.php?action=update'>执行更新操作</a><br>";
check.php
<?php if(isset($_GET['action'])){ switch($_GET['action']){ case "add": echo "<script>alert('add');</script>"; break; case "del": echo "<script>alert('del');</script>"; break; case "search": echo "<script>alert('search');</script>"; break; case "update"; echo "<script>alert('update');</script>"; break; default: echo "<script>alert('error');</script>"; break; } // echo "<script>window.location = 'test.php';</script>"; echo "<script>history.go(-1);</script>"; }