當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。