test.php
<?php header("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>"; }