<?php require "data_operate.php"; if ($_REQUEST['operate_type'] === "insert") { //创建操作对象 $request = new insert_data($_REQUEST['news_title'], $_REQUEST['news_title_pic'], $_REQUEST['news_content'], $_REQUEST['news_add_time'], $_REQUEST['news_author'], $_REQUEST['table_name']); //连接数据库 $request->connect_database(); //执行sql代码 $request->query(); //查询并返回最新状态 echo $request->select_new_data(); //关闭数据库连接 $request->close(); }