亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

?? ?? ??

1. ?? ?? ? ??? ??

? ArticleAddHtml.php ?? ???:

Baidu? ueditor ????? ???? ?????.

???? ???:

?? ????? ?????: (http ://ueditor.baidu.com ), ??? ?? PHP ??? ??????? ???? ???? ?????:

微信圖片_20180306160555.png

?????? ??? ? ? ???? ?? ????? ??? umeditor ??? ??? ? ???? . ? ????? ??? ????.

微信圖片_20180306160758.png


?? ??? ??? ????.(ArticleAddHtml.php)

<?php
require './header.php';
header("Content-Type:text/html;charset=utf-8");
?>
<h1>后臺文章管理頁面</h1>
<form method="post">
    文章分類:
    <select name="category">
        <?php foreach ($category as $v):?>
            <option value="<?php echo $v['id'];?>"><?php echo $v['name'];?></option>
        <?php endforeach;?>
    </select>
    <a href="category.php">分類管理</a><br>
    標題:<input type="text" name="title"><br>
    作者:<input type="text" name="author">
    <div>
        <link href="./umeditor/themes/default/css/umeditor.min.css" rel="stylesheet">
        <script src="./umeditor/third-party/jquery.min.js"></script>
        <script src="./umeditor/umeditor.config.js"></script>
        <script src="./umeditor/umeditor.min.js"></script>
        <script src="./umeditor/lang/zh-cn/zh-cn.js"></script>
        <script>
            $(function () {
                UM.getEditor('myEditor');
            });
        </script>
        <script type="text/plain" id="myEditor" style="width: 1025px;height: 250px" name="content">
            <p>添加文章內(nèi)容......</p>
        </script>
        </div>
    <input type="submit" value="提交">
    <input type="button" value="取消" onclick="{if(confirm('確定要取消添加文章嗎?')){window.location.href='index.php';}return false;}">
</form>

? ??? ????.

微信圖片_20180306161129.png

2 , ??? ArticleAdd.php ??? ?????

?? ? ?? ?????? ???? ?? ??

??? ??? ????:

<?php
require './init.php';
$sql='select id,name from cms_category order by sort';
$category=$db->fetchAll($sql);
if (!empty($_POST)){
    //獲取文章分類
    $data['cid']=isset($_POST['category'])?abs(intval($_POST['category'])):0;
    //獲取文章標題
    $data['title']=isset($_POST['title'])?trim(htmlspecialchars($_POST['title'])):'';
    //獲取作者
    $data['author']=isset($_POST['author'])?trim(htmlspecialchars($_POST['author'])):'';
    //獲取文章內(nèi)容
    $data['content']=isset($_POST['content'])?trim($_POST['content']):'';
    if(empty($data['cid'])||empty($data['title'])||empty($data['author'])){
        $error[]='文章分類,標題,作者不能為空!';
    }else{
        $sql="insert into cms_article(title,content,author,addtime,cid)values(:title,:content,:author,now(),:cid)";
        $db->data($data)->query($sql);
        //跳轉(zhuǎn)到首頁
        header("location:index.php");
    }
}
require './ArticleAddHtml.php';

3, ?? ??:

gif5新文件 (4).gif

???? ??
||
<?php echo "文章添加功能";