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