當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArticleModel::model方法代碼示例

本文整理匯總了PHP中ArticleModel::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleModel::model方法的具體用法?PHP ArticleModel::model怎麽用?PHP ArticleModel::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArticleModel的用法示例。


在下文中一共展示了ArticleModel::model方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isset

    $promote_id = $_POST['promote_id'];
    $num_iids = $_POST['num_iids'];
    $pindao_id = $_POST['pindao_id'];
    $ZhuyaoPic = $_POST['ZhuyaoPic'];
    $suluetu1 = $_POST['suluetu1'];
    $suluetu2 = $_POST['suluetu2'];
    $help_id = $_POST['help_id'];
    $yonghu = $_POST['yonghu'];
    $D_dizhi = $_POST['D_dizhi'];
    $gift_id = isset($_POST['gift_id']) ? $_POST['gift_id'] : 0;
    $tiaoyong_id = $_POST['tiaoyong_id'];
    if ($title == "" || $content == "") {
        $updateMessage = "請把信息填寫完整!!";
    } else {
        $sql = 'SELECT * FROM `article` WHERE `title`="' . $title . '" AND `id`<>"' . $id . '"';
        $rs = $pdo->query($sql);
        $row = $rs->fetchAll();
        if (count($row) == 0) {
            $row = array('title' => $title, 'category_id' => $category_id, 'keyword' => $keyword, 'description' => $description, 'content' => $content, 'tag' => $tag, 'promote_id' => $promote_id, 'num_iids' => $num_iids, 'pindao_id' => $pindao_id, 'ZhuyaoPic' => $ZhuyaoPic, 'suluetu1' => $suluetu1, 'suluetu2' => $suluetu2, 'help_id' => $help_id, 'yonghu' => $yonghu, 'D_dizhi' => $D_dizhi, 'tiaoyong_id' => $tiaoyong_id, 'gift_id' => $gift_id);
            $result = ArticleModel::model()->update(array('id' => $id), $row);
            if ($result > 0) {
                $updateMessage = "修改成功";
            } else {
                echo $sql;
                $updateMessage = "修改失敗";
            }
        } else {
            $updateMessage = '標題 重複';
        }
    }
}
開發者ID:kwdwkiss,項目名稱:trial,代碼行數:31,代碼來源:ArticleUpdate.php

示例2: time

    $promote_id = $_POST["promote_id"];
    $num_iids = $_POST["num_iids"];
    $pindao_id = $_POST["pindao_id"];
    $create_time = $_POST["create_time"] = time();
    $ZhuyaoPic = $_POST['ZhuyaoPic'];
    $suluetu1 = $_POST['suluetu1'];
    $suluetu2 = $_POST['suluetu2'];
    $help_id = $_POST['help_id'];
    $yonghu = $_POST['yonghu'];
    $D_dizhi = $_POST['D_dizhi'];
    $gift_id = $_POST['gift_id'];
    $tiaoyong_id = $_POST['tiaoyong_id'];
    if ($title == "" || $content == "") {
        $createMessage = "請把文章信息填寫完整!!";
    } else {
        $sql = 'SELECT * FROM `article` WHERE `title`="' . $title . '" AND `id`<>"' . $id . '"';
        $rs = $pdo->query($sql);
        $row = $rs->fetchAll();
        //取得所有記錄
        if (count($row) == 0) {
            $lastetId = ArticleModel::model()->create($_POST);
            if ($lastetId != FALSE) {
                $createMessage = "添加成功";
            } else {
                $createMessage = "添加失敗";
            }
        } else {
            $createMessage = '標題重複!';
        }
    }
}
開發者ID:kwdwkiss,項目名稱:trial,代碼行數:31,代碼來源:ArticleCreate.php

示例3: count

    $sql = 'SELECT * FROM `article` WHERE `category_id`=' . $searchCategoryId . $sql_key_str . ' ORDER BY `id` DESC';
} else {
    $sql = 'SELECT * FROM `article` WHERE 1 ' . $sql_key_str . ' ORDER BY `id` DESC';
}
$pageSize = 30;
//頁麵大小
$count = count($pdo->query($sql)->fetchAll());
$totalPage = ceil($count / $pageSize);
$init = 1;
$page_len = 9;
//頁碼個數
$max_p = $totalPage;
$pages = $totalPage;
$offset = $pageSize * ($page - 1);
$sql = $sql . " LIMIT {$offset},{$pageSize}";
$articleArr = ArticleModel::model()->findAllBySql($sql);
$page_len = $page_len % 2 ? $page_len : $pagelen + 1;
//頁碼個數
$pageoffset = ($page_len - 1) / 2;
//頁碼個數左右偏移量
$key = '<div class="page">';
$key .= "<span>{$page}/{$pages}</span> ";
//第幾頁,共幾頁
if ($page != 1) {
    $key .= "<a href=\"article_manage.php?page=1" . "&searchCategoryId=" . $searchCategoryId . "&searchWord=" . urlencode($searchWord) . "\">首頁</a> ";
    //第一頁
    $key .= "<a href=\"article_manage.php?page=" . ($page - 1) . "&searchCategoryId=" . $searchCategoryId . "&searchWord=" . urlencode($searchWord) . "\">上一頁</a>";
    //上一頁
} else {
    $key .= "首頁 ";
    //第一頁
開發者ID:kwdwkiss,項目名稱:trial,代碼行數:31,代碼來源:ArticleManage.php


注:本文中的ArticleModel::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。