本篇实现发表博客。
八、发表博客(1)、界面实现file.php
(2)后台添加到数据库实现check_file.php
<?php session_start(); require_once 'Conn/SqlHelper.class.php'; $flag = $_GET['flag']; if($flag!=2){ $txt_title = $_POST['txt_title']; $file = $_POST['file']; $author = $_SESSION['username']; $date = date("Y-m-d H:i:s"); } $sqlHelper = new SqlHelper(); if($flag==0){ $sql = "insert into tb_article(title,content,author,now)values('$txt_title','$file','$author','$date')"; } $res = $sqlHelper->execute_dml($sql); if($res==1){ echo ""; echo ""; }else{ echo ""; echo ""; }?>