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


PHP Date::time方法代码示例

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


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

示例1: create_user

 public function create_user($userdata)
 {
     $password = \Arr::get($userdata, 'password', null);
     $email = \Arr::get($userdata, 'email', null);
     if (is_null($password) || is_null($email)) {
         Logger::instance()->log_log_in_attempt(Model_Log_In_Attempt::$ATTEMPT_BAD_CRIDENTIALS, $email);
         throw new LogInFailed(\Lang::get('ethanol.errors.loginInvalid'));
     }
     $user = Auth_Driver::get_core_user($email);
     $security = new Model_User_Security();
     //Generate a salt
     $security->salt = Hasher::instance()->hash(\Date::time(), Random::instance()->random());
     $security->password = Hasher::instance()->hash($password, $security->salt);
     if (\Config::get('ethanol.activate_emails', false)) {
         $keyLength = \Config::get('ethanol.activation_key_length');
         $security->activation_hash = Random::instance()->random($keyLength);
         $user->activated = 0;
         //Send email
         \Package::load('email');
         //Build an array of data that can be passed to the email template
         $emailData = array('email' => $user->email, 'activation_path' => \Str::tr(\Config::get('ethanol.activation_path'), array('key' => $security->activation_hash)));
         $email = \Email::forge()->from(\Config::get('ethanol.activation_email_from'))->to($user->email, $user->username)->subject(\Config::get('ethanol.activation_email_subject'))->html_body(\View::forge('ethanol/activation_email', $emailData))->send();
     } else {
         $user->activated = 1;
         $security->activation_hash = '';
     }
     $user->security = $security;
     $user->save();
     $user->clean_security();
     return $user;
 }
开发者ID:inespons,项目名称:ethanol,代码行数:31,代码来源:Database.php

示例2: main

 private function main(\Orm\Model $obj)
 {
     if (!($datetime = $this->get_datetime_from_relational_model($obj))) {
         $datetime = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
     }
     $obj->{$this->_property} = $datetime;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:7,代码来源:createdatcopyfromrelationaltable.php

示例3: get4slug

 public static function get4slug($slug, $is_published = true)
 {
     $query = self::query()->where('slug', $slug);
     if ($is_published) {
         $query->where('is_published', 1);
         $query->where('published_at', '<', \Date::time()->format('mysql'));
     }
     return $query->get_one();
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:9,代码来源:news.php

示例4: before_update

 public function before_update(\Orm\Model $obj)
 {
     if (\Util_Orm::check_is_updated($obj, $this->_check_properties, $this->_ignore_properties)) {
         if (!empty($obj->{$this->_property_from})) {
             $obj->{$this->_property} = $obj->{$this->_property_from};
         } else {
             $obj->{$this->_property} = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
         }
     }
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:10,代码来源:sortdatetime.php

示例5: before_save

 public function before_save(\Orm\Model $obj)
 {
     if ($this->_overwrite or empty($obj->{$this->_property})) {
         if ($obj->is_new()) {
             $obj->{$this->_property} = $obj->{$this->_property_from};
         } else {
             $obj->{$this->_property} = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
         }
     }
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:10,代码来源:updatedat.php

示例6: gc

 function gc($max_life_time)
 {
     if ($max_life_time == 0) {
         return TRUE;
     }
     $exp_time = Date::time() - $max_life_time;
     $db = Database::factory($this->db_name);
     $ret = $db->query('DELETE FROM `_session` WHERE mtime < %d', $exp_time);
     return !is_null($ret);
 }
开发者ID:pihizi,项目名称:qf,代码行数:10,代码来源:database.php

示例7: check_is_passed

 public static function check_is_passed($past_time, $intarval_time, $base_time = '', $is_time_format = true)
 {
     if (!$is_time_format) {
         $past_time = strtotime($past_time);
         if ($base_time) {
             $base_time = strtotime($base_time);
         }
     }
     if (!$base_time) {
         $base_time = Date::time()->get_timestamp();
     }
     return $base_time > $past_time + $intarval_time;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:13,代码来源:date.php

示例8: before_update

 /**
  * Set the UpdatedAt property to the current time.
  *
  * @param  Model  Model object subject of this observer method
  */
 public function before_update(Model $obj)
 {
     // If there are any relations loop through and check if any of them have been changed
     $relation_changed = false;
     foreach ($this->_relations as $relation) {
         if ($this->relation_changed($obj, $relation)) {
             $relation_changed = true;
             break;
         }
     }
     if ($obj->is_changed() or $relation_changed) {
         $obj->{$this->_property} = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
     }
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:19,代码来源:updatedat.php

示例9: main

 private function main(\Orm\Model $obj)
 {
     if (!\Util_Orm::check_is_updated($obj, $this->_check_properties, $this->_ignore_properties)) {
         return;
     }
     if (!($datetime = $this->get_datetime_from_relational_model($obj))) {
         if (!$obj->is_new() || !empty($obj->{$this->_property})) {
             return;
         }
         if (!empty($obj->{$this->_property_created_at})) {
             $datetime = $obj->{$this->_property_created_at};
         } else {
             $datetime = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
         }
     }
     $obj->{$this->_property} = $datetime;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:17,代码来源:updatedatcopyfromrelationaltable.php

示例10: action_index

 public function action_index()
 {
     $query = Model_WeatherList::query()->where('date', Date::time()->format("%Y-%m-%d"))->where('type', 'max_cold');
     $coldList = $query->get_one();
     if ($coldList != null) {
         $coldData = $coldList->weatherData;
     } else {
         $coldData = [];
     }
     $query = Model_WeatherList::query()->where('date', Date::time()->format("%Y-%m-%d"))->where('type', 'max_rain');
     $rainList = $query->get_one();
     if ($rainList != null) {
         $rainData = $coldList->weatherData;
     } else {
         $rainData = [];
     }
     $data = ['coldData' => $coldData, 'rainData' => $rainData];
     $this->template->title = '';
     $this->template->body = View::forge('measurements/index', $data);
 }
开发者ID:Adriaan420,项目名称:Leertaak5,代码行数:20,代码来源:measurements.php

示例11: fuzzy

 static function fuzzy($time, $detail = FALSE, $now = 0)
 {
     if (!$time) {
         return T('早些时候');
     }
     if (!$now) {
         $now = Date::time();
     }
     $diff = $now - $time;
     $nd = getdate($now);
     $td = getdate($time);
     if ($detail) {
         $time_format = Date::default_format('time');
         if ($diff > 0 && $diff < 86400 && $nd['yday'] == $td['yday']) {
             $rest = $diff % 3600;
             $hours = ($diff - $rest) / 3600;
             $seconds = $rest % 60;
             $minutes = ($rest - $seconds) / 60;
             if ($hours > 1) {
                 return Date::format($time, $time_format);
             } elseif ($hours == 1) {
                 return T('一个多小时前');
             }
             return T('几分钟前');
         } elseif (date('Y', $now) == date('Y', $time)) {
             return Date::format($time, 'm/d ' . $time_format);
         } else {
             return Date::format($time, 'Y/m/d ' . $time_format);
         }
     }
     if ($nd['year'] == $td['year']) {
         if ($nd['yday'] == $td['yday']) {
             return T('今天');
         } elseif ($nd['yday'] - 1 == $td['yday']) {
             return T('昨天');
         }
         return Date::format($time, 'm/d');
     }
     return Date::format($time, 'Y/m/d');
 }
开发者ID:pihizi,项目名称:qf,代码行数:40,代码来源:date.php

示例12: before_insert

 public function before_insert(Model $obj)
 {
     $obj->{static::$property} = static::$mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:4,代码来源:createdat.php

示例13: init

 /**
  * generic driver initialisation
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     // get a time object
     $this->time = \Date::time();
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:11,代码来源:driver.php

示例14: before_save

 public function before_save(Model $obj)
 {
     if ($obj->is_new() or $obj->is_changed()) {
         $obj->{static::$property} = static::$mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
     }
 }
开发者ID:469306621,项目名称:Languages,代码行数:6,代码来源:updatedat.php

示例15: countup_account_lock_count

 /**
  * Set account lock information.
  *
  * @return  bool
  */
 private function countup_account_lock_count($email)
 {
     if (!\Config::get('uzuraauth.accountLock.isEnabled')) {
         return;
     }
     $login_failed_info = \Session::get('login_failed', array());
     $login_failed_count_current = isset($login_failed_info[$email]['count']) ? $login_failed_info[$email]['count'] : 0;
     $login_failed_count_current++;
     \Session::set('login_failed', array($email => array('count' => $login_failed_count_current, 'last_execute_time' => \Date::time()->get_timestamp())));
     if ($login_failed_count_current >= \Config::get('uzuraauth.accountLock.loginFailAcceptCount')) {
         if (\Config::get('uzuraauth.accountLock.isLogging')) {
             \Util_Toolkit::log_error('account_lock: ' . $email);
         }
         $this->sent_noticication_mail($email);
     }
     return $login_failed_count_current;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:22,代码来源:uzuraauth.php


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