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


PHP article::getId方法代碼示例

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


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

示例1: date

 * 負責處理新發表文章的邏輯
 * Createed By C860 at 2014-1-19
 */
if (!class_exists('sys')) {
    include_once '../conf/config.php';
}
//需要登錄
sys::needLog('../login.php');
//檢測數據合法性
if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['content']) && !empty($_POST['content']) && isset($_POST['tags']) && !empty($_POST['tags'])) {
    //引入相關模型類
    include_once '../Models/article.php';
    include_once '../Models/tag_relate_article.php';
    include_once '../Models/user_info.php';
    $currentTime = date('Y-m-d H:i:s');
    //新增文章
    if (article::add($_POST['title'], $_POST['content'], $currentTime, $_SESSION['userId'])) {
        $ID = article::getId($_POST['title'], $_SESSION['userId'], $currentTime);
        $tags = explode('|', $_POST['tags']);
        foreach ($tags as $tag) {
            tag_relate_article::add($tag, $ID);
        }
        user_info::increaseArticleCount($_SESSION['userId']);
        sys::alert('發表成功!');
        sys::redirect('../index.php');
    }
} else {
    //引入相關模型類
    include_once 'Models/tag.php';
    $taglist = tag::getAllTags();
}
開發者ID:dalinhuang,項目名稱:HCI-MSGsystem,代碼行數:31,代碼來源:newArticle.php

示例2: showArticleAdministration

function showArticleAdministration()
{
    require_once ROOT . "includes/items.php";
    require_once ROOT . "DBInterface/articleDB.php";
    require_once ROOT . "DBInterface/languageDB.php";
    require_once ROOT . "DBInterface/articleTranslationDB.php";
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'add') {
            $articleDB = new ArticleDB();
            $res = $articleDB->addArticle($_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
            $resID = $res->fetch_object();
            $artID = $resID->Article_ID;
            saveCategory($artID);
            saveLanguages($artID);
        } else {
            if ($_POST['action'] == 'update') {
                $articleDB = new ArticleDB();
                $artID = $_POST['artId'];
                $res = $articleDB->updateArticle($_POST['artId'], $_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
                saveCategory($artID);
                saveLanguages($artID);
            } else {
                if ($_POST['action'] == 'delete') {
                    $artID = $_POST['artId'];
                    deleteArticle($artID);
                }
            }
        }
    }
    $lang = $_COOKIE["lang"];
    include ROOT . "resources/{$lang}.php";
    $items = array();
    $article = null;
    $articleDB = new ArticleDB();
    echo "<table  class=\"basket-table\" border=\"1px\">";
    echo "<thead>";
    echo "<tr>";
    echo "<th>{$adminArticleId}</th>";
    echo "<th>{$adminArticleName}</th>";
    echo "<th>{$adminArticleDescription}</th>";
    echo "<th>{$adminArticlePrice}</th>";
    echo "<th>{$adminArticleImage}</th>";
    echo "<th>&nbsp;</th>";
    echo "<th>&nbsp;</th>";
    echo "</tr>";
    echo "</thead>";
    echo "<tbody>";
    $res = $articleDB->getAllArticles();
    while ($items = $res->fetch_object()) {
        $articleId = $items->Article_ID;
        $articleName = $items->ArticleName;
        $articleDescription = $items->ArticleDescription;
        $articlePrice = $items->ArticlePrice;
        $articleImage = $items->ArticleImage;
        $article = new article($articleId, $articleName, $articlePrice, $articleDescription, $articleImage, null);
        echo "<tr>";
        echo "<td>" . $article->getId() . "</td>";
        echo "<td>" . $article->getName() . "</td>";
        echo "<td>" . $article->getDescription() . "</td>";
        echo "<td>" . $article->getPrice() . "</td>";
        echo "<td>" . $article->getImage() . "</td>";
        echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
        echo "<input type=\"hidden\" name=\"origin\" value=\"update\" /input>";
        echo "<td> <input class=\"basket-update-button\" type=\"submit\" value=\"{$adminArticleUpdateLabel}\"/></td>";
        echo "</form>";
        echo "<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"action\" value=\"delete\" /input>";
        echo "<td> <input class=\"basket-delete-button\" name=\"delete\" type=\"submit\" value=\"{$adminArticleDeleteLabel}\"/></td>";
        echo "</form>";
        echo "</tr>";
        echo "</form>";
    }
    // last line to add a new article
    echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
    // echo "<input type=\"hidden\" name=\"articleId\" value=\"" . $articleId . "\" /input>";
    echo "<tr>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
    echo "<input type=\"hidden\" name=\"origin\" value=\"add\" /input>";
    echo "<td> <input class=\"basket-update-button\"  type=\"submit\" value=\"{$adminArticleAddLabel}\"/></td>";
    echo "</tr>";
    echo "</form>";
    echo "</tbody>";
    echo "</table>";
}
開發者ID:nellen,項目名稱:ch.bfh.bti7054.w2014.q.Web-Prophecies,代碼行數:93,代碼來源:administration.php


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