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


PHP Facade::isoDateTime方法代码示例

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


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

示例1: catch

        $snid = ['facebook' => 1, 'twitter' => 2];
        // Get id
        $identifier = $user_profile->identifier;
        // Check if user exist
        if (R::findOne('users', ' snid = ? AND identifier = ?', array($snid[$idp], $user_profile->identifier))) {
            \Hybrid_Auth::storage()->set('user', ['identifier' => $user_profile->identifier, 'snid' => $snid[$idp]]);
            $app->redirect($app->wroot . '/welcome/');
        } else {
            $user = R::dispense('users');
            $user->snid = $snid[$idp];
            $user->identifier = $user_profile->identifier;
            $user->email = $user_profile->email;
            $user->first_name = $user_profile->firstName;
            $user->last_name = $user_profile->lastName;
            $user->avatar_url = $user_profile->photoURL;
            $user->reg = R::isoDateTime();
            if (R::store($user)) {
                \Hybrid_Auth::storage()->set('user', ['identifier' => $user_profile->identifier, 'snid' => $snid[$idp]]);
                $app->redirect($app->wroot . '/welcome/');
            }
        }
        // Get error
    } catch (Exception $e) {
        echo $e->getMessage();
    }
});
// Logout
$app->get('/logout/', function () use($app) {
    $app->hybridInstance;
    \Hybrid_Auth::storage()->set('user', null);
    Hybrid_Auth::logoutAllProviders();
开发者ID:rodrigopolo,项目名称:HybridAuthDemo,代码行数:31,代码来源:app.php

示例2: testBeautifulColumnNames

 /**
  * Test beautification of column names.
  *
  * @return void
  */
 public function testBeautifulColumnNames()
 {
     testpack('Beautiful column names');
     $town = R::dispense('town');
     $town->isCapital = FALSE;
     $town->hasTrainStation = TRUE;
     $town->name = 'BeautyVille';
     $houses = R::dispense('house', 2);
     $houses[0]->isForSale = TRUE;
     $town->ownHouse = $houses;
     R::store($town);
     $town = R::load('town', $town->id);
     asrt($town->isCapital == FALSE, TRUE);
     asrt($town->hasTrainStation == TRUE, TRUE);
     asrt($town->name == 'BeautyVille', TRUE);
     testpack('Accept datetime objects.');
     $cal = R::dispense('calendar');
     $cal->when = new \DateTime('2000-01-01', new \DateTimeZone('Pacific/Nauru'));
     asrt($cal->when, '2000-01-01 00:00:00');
     testpack('Affected rows test');
     $currentDriver = $this->currentlyActiveDriverID;
     $toolbox = R::getToolBox();
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     $bean = $redbean->dispense('bean');
     $bean->prop = 3;
     //make test run with strict mode as well
     $redbean->store($bean);
     $adapter->exec('UPDATE bean SET prop = 2');
     asrt($adapter->getAffectedRows(), 1);
     testpack('Testing Logger');
     R::getDatabaseAdapter()->getDatabase()->setLogger(new RDefault());
     asrt(R::getDatabaseAdapter()->getDatabase()->getLogger() instanceof Logger, TRUE);
     asrt(R::getDatabaseAdapter()->getDatabase()->getLogger() instanceof RDefault, TRUE);
     $bean = R::dispense('bean');
     $bean->property = 1;
     $bean->unsetAll(array('property'));
     asrt($bean->property, NULL);
     asrt($bean->setAttr('property', 2) instanceof OODBBean, TRUE);
     asrt($bean->property, 2);
     asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/', R::isoDate()), 1);
     asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d/', R::isoDateTime()), 1);
     $redbean = R::getRedBean();
     $adapter = R::getDatabaseAdapter();
     $writer = R::getWriter();
     asrt($redbean instanceof OODB, TRUE);
     asrt($adapter instanceof Adapter, TRUE);
     asrt($writer instanceof QueryWriter, TRUE);
     R::setRedBean($redbean);
     pass();
     //cant really test this
     R::setDatabaseAdapter($adapter);
     pass();
     //cant really test this
     R::setWriter($writer);
     pass();
     //cant really test this
     $u1 = R::dispense('user');
     $u1->name = 'Gabor';
     $u1->login = 'g';
     $u2 = R::dispense('user');
     $u2->name = 'Eric';
     $u2->login = 'e';
     R::store($u1);
     R::store($u2);
     $list = R::getAssoc('select login,' . R::getWriter()->esc('name') . ' from ' . R::getWriter()->esc('user') . ' ');
     asrt($list['e'], 'Eric');
     asrt($list['g'], 'Gabor');
     $painting = R::dispense('painting');
     $painting->name = 'Nighthawks';
     $id = R::store($painting);
     testpack('Testing SQL Error Types');
     foreach ($writer->typeno_sqltype as $code => $text) {
         asrt(is_integer($code), TRUE);
         asrt(is_string($text), TRUE);
     }
     foreach ($writer->sqltype_typeno as $text => $code) {
         asrt(is_integer($code), TRUE);
         asrt(is_string($text), TRUE);
     }
     testpack('Testing Nowhere Pt. 1 (unfrozen)');
     foreach (array('exec', 'getAll', 'getCell', 'getAssoc', 'getRow', 'getCol') as $method) {
         R::$method('select * from nowhere');
         pass();
     }
     testpack('Testing Nowhere Pt. 2 (frozen)');
     R::freeze(TRUE);
     foreach (array('exec', 'getAll', 'getCell', 'getAssoc', 'getRow', 'getCol') as $method) {
         try {
             R::$method('select * from nowhere');
             fail();
         } catch (SQL $e) {
             pass();
//.........这里部分代码省略.........
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:101,代码来源:Misc.php

示例3: inserterrorlog

 /**
  * CREATE TABLE `errorlogs` (
  * `id` int(11) NOT NULL AUTO_INCREMENT,
  * `errtype` varchar(255) DEFAULT NULL,
  * `errcode` varchar(255) DEFAULT NULL,
  * `errmessage` varchar(255) DEFAULT NULL,
  * `method` varchar(255) DEFAULT NULL,
  * `user` varchar(255) DEFAULT NULL,
  * `create_date` datetime DEFAULT NULL,
  * PRIMARY KEY (`id`)
  * @param object $item RedBeanPHP\Plugin\errorlog
  */
 public function inserterrorlog($errlog, $userid = NULL)
 {
     try {
         $arrCol = R::getColumnFromTable('errorlogs');
         $item = R::assignItem2Column($arrCol, $errlog);
         //$item = json_decode (json_encode ($item), FALSE);
         $errbean = R::dispense('errorlogs');
         $errbean->errtype = $errlog->errtype;
         $errbean->errcode = $errlog->errcode;
         $errbean->errmessage = $errlog->errmessage;
         $errbean->method = $errlog->method;
         $errbean->user = $errlog->user;
         $errbean->create_date = R::isoDateTime();
         $id = R::store($errbean);
         error_log($errbean->errmessage);
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:limweb,项目名称:webappservice,代码行数:31,代码来源:SystemlogsService.php


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