<?php require "data_operate.php"; if ($_REQUEST['operate_type'] === "get_one_news") { //创建操作对象 $request = new open_news($_REQUEST['news_id'], $_REQUEST['table_name']); //连接数据库 $request->connect_database(); //执行sql代码并返回 echo $request->get_one_news(); //关闭数据库连接 $request->close(); }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>baidu_news</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="renderer" content="webkit"> <!--使360开启极速模式--> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/new_page.css"> </head> <body> <?php require "back/data_operate.php"; //创建操作对象 $request = new open_news($_REQUEST['news_id'], $_REQUEST['table_name']); //连接数据库 $request->connect_database(); //执行sql代码并返回数据 $data = json_decode($request->get_one_news()); //关闭数据库连接 $request->close(); ?> <div class="wrapper"> <header> <div class="top-toolbar"></div> </header> <div class="content"> <div class="article"> <div class="article-header">