刘华世的官方博客

php模拟数据库常用操作效果

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>";
    }

posted @ 2015-09-04 16:21  刘华世的博客  阅读(740)  评论(0编辑  收藏  举报
刘华世的官方博客