当前位置: 首页>>代码示例>>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;未经允许,请勿转载。