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


PHP Domain::update方法代码示例

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


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

示例1: index

 function index()
 {
     //        $url = 'http://www.lib.nccu.edu.tw/?m=1109&sn=54&id=92&mm=1101';
     //        $host = 'http://www.lib.nccu.edu.tw/';
     //        $title = '政治大學圖書館網站';
     $url = 'http://pulipuli.blogspot.com/2010/07/2010711.html';
     $host = 'http://pulipuli.blogspot.com/';
     $title = '布丁布丁吃?';
     //以下才是正是的測試開始
     create_context(TRUE);
     $this->load->library('kals_resource/Domain');
     $domain2 = new Domain();
     $domain2->set_field('url', $url);
     $domain2->update();
     $this->unit->run($domain2->get_field("url"), $host, '以new建立domain2,測試get_field("url")');
     $domain = $this->domain->create($url);
     $domain_id = $domain->get_id();
     $this->unit->run($domain_id, 'is_int', '用ctreate()來建立Domain,看看是否有id');
     $test_domain = $this->domain->create($url);
     $test_domain_id = $test_domain->get_id();
     //echo $test_domain_id;
     $this->unit->run($test_domain->get_field("url"), $host, '測試get_host');
     $this->unit->run($domain_id != NULL, TRUE, '測試test_domain是不是真的find到domain');
     $this->unit->run($domain_id, $test_domain_id, '測試test_domain是不是真的find到domain');
     $this->unit->run($test_domain->get_id(), $domain_id, '用ctreate()以同樣的url來建立Domain,看看是否有id');
     $this->unit->run($test_domain->get_field('title'), $title, '再建立時,是否就能找到title?');
     $id = $test_domain->get_id();
     $test_domain = new Domain($id);
     $this->unit->run($test_domain->get_id() != NULL, TRUE, '測試用id來find Domain');
     $this->unit->run($test_domain->get_field('url'), $host, '測試用id來find Domain 測試get_host');
     $this->unit->run($test_domain->get_field('title'), $title, '測試title');
     $domains = $this->domain->find_all();
     $this->unit->run(count($domains) > 0, TRUE, '測試find_all是否有找到東西');
     $domains = $this->domain->find_all(array('domain_id' => $id));
     $this->unit->run(count($domains), 1, '測試find_all加上條件,是否能找到測試時建立的domain');
     $this->unit->run($domains[0]->get_id(), $id, '測試find_all中能不能get_id()');
     $this->unit->run($domains[0]->get_host(), $host, '測試find_all中能不能get_host()');
     $test_domain->delete();
     $this->unit->run($test_domain->get_id(), NULL, '測試刪除之後,Domain ID還在不在這件事情');
     $domain_deleted = $this->domain->find($url);
     $this->unit->run($domain_deleted, NULL, '測試刪除之後,Domain還能不能找到這件事情');
     //context_complete();
     //context_abort();
     unit_test_report($this);
     //destory_context();
 }
开发者ID:119155012,项目名称:kals,代码行数:46,代码来源:ut_domain.php

示例2: actionEdit

 public function actionEdit()
 {
     $msgDomain = "";
     $rsInfo = "";
     $request = Yii::app()->getRequest();
     $id = trim($request->getParam("id"));
     if (!empty($_POST)) {
         $name = trim($request->getPost("name"));
         $admin = trim($request->getPost("admin"));
         $username = trim($request->getPost("username"));
         $password = trim($request->getPost("password"));
         $provider = trim($request->getPost("provider"));
         $status = trim($request->getPost("status"));
         if ($name == "") {
             $msgDomain = "域名名称选项不能留空";
         } else {
             if (strlen($name) > 64) {
                 $msgDomain = "输入不能大于64个字符";
             }
         }
         if ($msgDomain == "") {
             $domain = array('name' => $name, 'admin' => $admin, 'username' => $username, 'password' => $password, 'provider' => $provider, 'status' => $status);
             try {
                 $res = new Domain();
                 $res->_pk = $id;
                 $res->_attributes = $domain;
                 $res->setIsNewRecord(false);
                 $res->update();
                 $this->redirect(array('list'));
             } catch (CDbException $e) {
                 throw CDbException($e);
             }
         }
     }
     try {
         $Rs = new Domain();
         $rsInfo = $Rs->findByPk($id);
     } catch (CDbException $e) {
         throw CDbException($e);
     }
     $this->render('edit', array('r' => Yii::app()->request->baseUrl . '/', 'rsInfo' => $rsInfo, 'msgDomain' => $msgDomain));
 }
开发者ID:humor-zo,项目名称:woc-yii,代码行数:42,代码来源:DomainController.php

示例3: doEdit

function doEdit()
{
    if (isset($_POST['submit'])) {
        $domain_id = $_POST['domain_id'];
        $domainname = $_POST['domainname'];
        $description = $_POST['description'];
        $sector = $_POST['psector'];
        $domain = new Domain();
        $domain->domain_id = $domain_id;
        $domain->domain_name = $domainname;
        $domain->description = $description;
        $domain->sector_id = $sector;
    }
    if ($domain_id == "") {
        message('Domain ID is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($domainname == "") {
        message('Domain Name is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($description == "") {
        message('Description is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($sector == "") {
        message('Sector is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } else {
        $domain->update($_GET['id']);
        message('Domain infomation updated successfully!', "info");
        redirect('index.php');
    }
}
开发者ID:allybitebo,项目名称:ucb,代码行数:31,代码来源:controller.php


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