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


PHP Articles::update方法代碼示例

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


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

示例1: actionModified

 /**
  * 提交信息
  */
 public function actionModified()
 {
     $data = $this->Common->getFilter($_POST);
     $aid = (int) $data['aid'];
     $article = $data['aritcle'];
     $content = $data['a_content'];
     $Articles = new Articles();
     $ArticlesContent = new ArticlesContent();
     if ($aid == 0) {
         $article['add_date'] = $this->Common->getDate();
         $content['aid'] = $Articles->insert($article);
         $ArticlesContent->insert($content);
         $article['aid'] = $content['aid'];
     } else {
         $where = array('aid' => $aid);
         $Articles->update($article, $where);
         $count = $ArticlesContent->getCount('*', $where);
         if ($count > 0) {
             $ArticlesContent->update($content, $where);
         } else {
             $content['aid'] = $aid;
             $ArticlesContent->insert($content);
         }
     }
     $this->jumpBox('成功!', Wave::app()->homeUrl . 'articles', 1);
 }
開發者ID:mamtou,項目名稱:wavephp,代碼行數:29,代碼來源:ArticlesController.php

示例2:

<?php

//We admit that Authors & Articles classes and their tables exist
//Get the article with id 1
$myArticle = Articles::getById(1);
//Check if character is found
if (!empty($myArticle)) {
    //Get the new author to link to the article
    $myAuthor = Authors::getById(2);
    if (!empty($myAuthor)) {
        //Update the "author" field of the article
        $myArticle->prop('author', $myAuthor);
        //And save the changes!
        Articles::update($myArticle);
    } else {
        echo 'The new author of the article is not found.';
    }
} else {
    echo 'The article to update is not found.';
}
開發者ID:Tailszefox,項目名稱:EntityPHP,代碼行數:20,代碼來源:update_one_to_many.php

示例3: Articles

<?php

include "Mapper.php";
include "MapperCollection.php";
include "Articles.php";
$map = new Articles("articles");
// Find
echo "Find\n";
$result = $map->find(2);
print_r($result);
// insert
echo "\nInsert\n";
$obj = new stdClass();
$obj->name = "Ny artikel";
$obj->body = "Blah blah yada yada";
$obj->author_id = 2;
$map->insert($obj);
echo "Inserted object:\n";
print_r($obj);
echo "delete\n";
$map->delete($obj);
//update
echo "\nUpdate:\n";
$result->name = "Modified";
$map->update($result);
開發者ID:jonolsson,項目名稱:Saturday,代碼行數:25,代碼來源:testMapper.php


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