当前位置: 首页>>代码示例>>PHP>>正文


PHP post::create方法代码示例

本文整理汇总了PHP中post::create方法的典型用法代码示例。如果您正苦于以下问题:PHP post::create方法的具体用法?PHP post::create怎么用?PHP post::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post的用法示例。


在下文中一共展示了post::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: date

<?php

date_default_timezone_set("Asia/Manila");
$date = date('Y-m-d H:i:s');
if (isset($_POST['btnpost'])) {
    include_once "post.php";
    $param = array("postTitle" => $_POST["title"], "postDesc" => $_POST["desc"], "userID" => $_SESSION['id'], "topicID" => $_GET['topicid'], "datePosted" => $date, "postStatus" => 1, "postLevel" => $_SESSION['level']);
    $query = new post();
    $query->create("tblpost", $param);
}
if (isset($_POST['btntopic'])) {
    include_once "topic.php";
    $param = array("topicTitle" => $_POST["title"], "topicDesc" => $_POST["content"], "dateCreated" => $date, "forumCatID" => $_POST["cbocategory"], "topicStatus" => 1);
    $query = new topic();
    $query->create("tbltopic", $param);
}
if (isset($_POST['btnreply'])) {
    include_once "post.php";
    $param = array("replyContent" => $_POST["message"], "postID" => $_GET["postid"], "userID" => $_SESSION["id"], "datePosted" => $date, "replyLevel" => $_SESSION["level"], "replyStatus" => 1);
    $query = new post();
    $query->add("tblreply", $param);
}
开发者ID:rexghadaffi,项目名称:newPacion,代码行数:22,代码来源:modal_controller.php

示例2: ucfirst

<?php

require "../../includes/conf.inc.php";
require "../../includes/functions.inc.php";
if (isset($_POST['postTitle'])) {
    $adminId = $_SESSION['adminId'];
    $postTitle = $_POST['postTitle'];
    $postTypId = $_POST['postTypId'];
    $subjectId = $_POST['subjectId'];
    $imp = $_POST['imp'];
    $postText = $_POST['postText'];
    $postTitle = ucfirst(sanitize_text($postTitle));
    $postText = trim(mysql_real_escape_string(stripslashes($postText)));
    if ($postTitle == '' || $postText == '') {
        //when any entry is empty
        $response = array('success' => 0, 'error' => 1, 'errorMsg' => 'Either Post Title Or Post Body is empty!');
    } else {
        $newPost = array('postTitle' => $postTitle, 'postText' => $postText, 'subjectId' => $subjectId, 'postTypId' => $postTypId, 'adminId' => $adminId, 'statusId' => 2, 'imp' => $imp);
        if (!post::create($newPost)) {
            $response = array('success' => 0, 'error' => 2, 'errorMsg' => 'Opps! Something Went Wrong!');
        } else {
            $response = array('success' => 1, 'error' => 0);
        }
    }
    /*$_SESSION['response'] = $response;
    	header("location: add.php");*/
    echo json_encode($response);
}
开发者ID:amriterry,项目名称:ptn,代码行数:28,代码来源:post.php


注:本文中的post::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。