本文整理汇总了PHP中Time函数的典型用法代码示例。如果您正苦于以下问题:PHP Time函数的具体用法?PHP Time怎么用?PHP Time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: desactiva
function desactiva($id) {
$id = $this->_bd->limpia($id);
$now = Time("U");
$sql = "UPDATE $this->_dbTable SET ESTADO_ACCION = 0, LastUpdateTime = '$now' WHERE ID_ACCION = $id";
// echo $sql."<br>";
$res = $this->_bd->sql($sql);
}
示例2: On_PostAction_iterator_fetch
function On_PostAction_iterator_fetch($a_data)
{
// Find iterator in template
$doc = new Template_Document($a_data->post['iterator_template']);
function search_func($node, $args)
{
if ($node instanceof Template_TagNode) {
return $node->getAttribute("name") == $args;
} else {
return false;
}
}
$itrs = $doc->getElementsByFunc(search_func, $a_data->post['iterator_name']);
$iterator = $itrs[0];
// Generate id
$id = Time("U") . substr((string) microtime(), 2, 6);
// Build iterator template
$node = new Node(-$id);
$node->Build($iterator);
// Pack JSON data
$data = array();
$data['id'] = $id;
$data['content'] = Editor::$m_data['module_data'][-$id];
print json_encode($data);
}
示例3: ExecuteQuery
function ExecuteQuery()
{
$this->data = array();
$date = new DateTimeValue(Time());
$notYet = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND ( due_date = \'0000-00-00 00:00:00\' OR due_date > \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "')"));
$today = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date = \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'"));
$past = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date > \'1900-01-01 00:00:00\' AND due_date < \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'"));
$value = 0;
if (isset($past)) {
$value = count($past);
}
$this->data['values'][0]['labels'][] = 'Overdue';
$this->data['values'][0]['values'][] = $value;
$value = 0;
if (isset($notYet)) {
$value = count($notYet);
}
$this->data['values'][0]['labels'][] = 'Not yet due';
$this->data['values'][0]['values'][] = $value;
$value = 0;
if (isset($today)) {
$value = count($today);
}
$this->data['values'][0]['labels'][] = 'Due today';
$this->data['values'][0]['values'][] = $value;
}
示例4: JPGText
function JPGText($str, $fontname, $fontsize, $backcol, $txtcol)
{
global $layout;
Header("Last-Modified: " . gmDate("D, d M Y H:i:s", Time()) . " GMT");
Header("Expires: " . gmDate("D, d M Y H:i:s", Time() - 3601) . " GMT");
Header("Pragma: no-cache");
Header("Cache-control: no-cache");
Header("Content-Type: image/jpeg");
$a = ImageTTFBBox($fontsize, 0, $fontname, $str);
$width = $a[2] + 4;
$bla = get_maximum_height($fontname, $fontsize);
$height = $bla[0] + 3;
$bl = $bla[1];
$im = ImageCreate($width, $height);
$bgcol = ImageColorAllocate($im, $backcol['red'], $backcol['green'], $backcol['blue']);
$fgcol = ImageColorAllocate($im, $txtcol['red'], $txtcol['green'], $txtcol['blue']);
if (!function_exists(imagegif)) {
imageTTFText($im, $fontsize, 0, 2, $bl + $fontsize / 6 + 2, $fgcol, $fontname, $str);
imagejpeg($im, "", 80);
} else {
ImageColorTransparent($im, $bgcol);
imageTTFText($im, $fontsize, 0, 2, $bl + $fontsize / 6 + 2, $fgcol, $fontname, $str);
imagegif($im);
}
ImageDestroy($im);
}
示例5: date_picker
function date_picker($name, $startyear = NULL, $endyear = NULL)
{
if ($startyear == NULL) {
$startyear = date("Y") - 10;
}
if ($endyear == NULL) {
$endyear = date("Y") + 5;
}
$cday = StrFTime("%d", Time());
$cmonth = StrFTime("%m", Time());
$cyear = StrFTime("%Y", Time());
$months = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
// roletka dnů
$html = "<select class=\"day\" name=\"" . $name . "day\">";
for ($i = 1; $i <= 31; $i++) {
$html .= "<option value='{$i}'" . ($i == $cday ? 'selected="selected"' : '') . ">{$i}</option>";
}
$html .= "</select> ";
// roletka měsíců
$html .= "<select class=\"month\" name=\"" . $name . "month\">";
for ($i = 1; $i <= 12; $i++) {
$html .= "<option value='{$i}'" . ($i == $cmonth ? 'selected="selected"' : '') . ">{$months[$i]}</option>";
}
$html .= "</select> ";
// roletka let
$html .= "<select class=\"year\" name=\"" . $name . "year\">";
for ($i = $startyear; $i <= $endyear; $i++) {
$html .= "<option value='{$i}'" . ($i == $cyear ? 'selected="selected"' : '') . ">{$i}</option>";
}
$html .= "</select> ";
return $html;
}
示例6: handle
function handle($g, $p, $s)
{
$this->smarty = $s;
$this->post = $p;
$this->get = $g;
if ($_SESSION['type'] != 'admin') {
//非管理员跳转回首页
header('location:index.php');
exit;
}
if (!isset($this->post['content'])) {
//不带post请求
$this->display();
} else {
$head = $this->post['head'];
$type = $this->post['type'];
//通知的对象在这里 分为 会员 管理员 教练
$content = $this->post['content'];
//通知内容在这里
/*
*下面需要将通知内容写进数据库 并通知成功
*/
$db = new db();
$db->addNotify($head, $content, Time(), $type);
$this->smarty->assign('message', '提交成功');
$this->smarty->display('libs/view/header.ctp');
$this->smarty->display('libs/view/operationSuccess.ctp');
$this->smarty->display('libs/view/sysmanag.ctp');
$this->smarty->display('libs/view/tail.ctp');
}
}
示例7: desactiva
function desactiva($id) {
// echo "desactiva<br>";
$now = Time("U");
$id = $this->_bd->limpia($id);
$sql = "UPDATE $this->_dbTable SET ESTADO_ALERTA_DEVICE = 0, LastUpdateTime = '$now' WHERE $this->_id = $id";
// echo $sql."<br>";
return $this->_bd->sql($sql);
}
示例8: securitygraph
function securitygraph($mysql_host = "", $mysql_user = "", $mysql_pass = "", $mysql_db = "")
{
$this->mysql = array("host" => $mysql_host, "user" => $mysql_user, "pass" => $mysql_pass, "db" => $mysql_db);
$this->conn = @mysql_connect($this->mysql['host'], $this->mysql['user'], $this->mysql['pass']) or die("<b>MySQL Error:</b> " . mysql_error());
@mysql_select_db($this->mysql['db'], $this->conn) or die("<b>MySQL Error:</b> Error selecting database '" . $this->mysql['db'] . "'");
$expiretime = Time() - 60 * 10;
// All codes that are still in the database after 10 minutes are removed
// get rid of the un-used codes
@mysql_query("DELETE FROM hashcodes WHERE timestamp < {$expiretime}", $this->conn) or die("<b>MySQL Error:</b> " . mysql_error());
}
示例9: testCaseSensitivity
/**
* Tests case insensitive mocks.
*
* @param string $mockName The mock function name.
*
* @test
* @dataProvider provideTestCaseSensitivity
*/
public function testCaseSensitivity($mockName)
{
$builder = new MockBuilder();
$builder->setNamespace(__NAMESPACE__)->setName($mockName)->setFunctionProvider(new FixedValueFunction(1234));
$this->mock = $builder->build();
$this->mock->enable();
$this->assertEquals(1234, time(), "time() is not mocked");
$this->assertEquals(1234, Time(), "Time() is not mocked");
$this->assertEquals(1234, TIME(), "TIME() is not mocked");
}
示例10: obtenCaracterMd5
function obtenCaracterMd5($car)
{
$md5Car = md5($car . Time());
//Codificar el carácter y el tiempo POSIX (timestamp) en md5
$arrCar = str_split(strtoupper($md5Car));
//Convertir a array el md5
$carToken = obtenCaracterAleatorio($arrCar);
//obtén un ítem aleatoriamente
return $carToken;
}
示例11: Register_Dashboard_Widget
function Register_Dashboard_Widget()
{
if (Count($this->Get_Extension_Names()) == 0) {
return False;
}
global $current_user;
get_currentuserinfo();
$this->is_dashboard = True;
$this->widget_id = Time();
Add_Meta_Box($this->widget_id, $this->t('Your contribution is still missed!'), array($this, 'Print_Contribution_Message'), 'dashboard', 'side', 'high');
}
示例12: actionEdit
/** Akcia pre editaciu oznamu
* @param int $id Id oznamu
*/
public function actionEdit($id)
{
if (($oznam = $this->oznam->hladaj_id($id, $this->id_reg)) === FALSE) {
$this->setView('notFound');
} else {
//Ak je vsetko OK priprav premenne
$this["oznamEditForm"]->setDefaults($oznam);
$this["oznamEditForm"]->setDefaults(['datum_zadania' => StrFTime("%Y-%m-%d %H:%M:%S", Time()), 'posli_news' => 0]);
$this->template->h2 = sprintf('Editácia oznamu: %s', $oznam->nazov);
}
}
示例13: rss
/**
* RSS feed of news.
* @return void
*/
public function rss()
{
// Special view for rss
$this->template = new View('rss');
$this->template->time = StrFTime("%a, %d %b %Y %H:%M:%S %z", Time());
// time of generation
$this->template->description = Kohana::lang('news.rss_description');
$this->set_title(Kohana::lang('news.news'));
$this->template->lang = '';
$this->template->address = url::base();
$this->template->items = $this->news->get(1, self::PER_PAGE);
}
示例14: authenticate
/**
* Performs an authentication
* @param array
* @return Nette\Security\Identity
* @throws Nette\Security\AuthenticationException
*/
public function authenticate(array $credentials)
{
list($username, $password) = $credentials;
$row = $this->database->table('users')->where('username', $username)->fetch();
if (!$row) {
//Ak sa nenajde username skus hladat email
$row = $this->database->table('users')->where('email', $username)->fetch();
}
if (!$row) {
throw new Nette\Security\AuthenticationException("User '{$username}' not found. Užívateľ '{$username}' sa nenašiel v databáze!", self::IDENTITY_NOT_FOUND);
}
if (!$row->activated) {
throw new Nette\Security\AuthenticationException("User '{$username}' not activated. Užívateľ '{$username}' ešte nie je aktivovaný!", self::FAILURE);
}
//Nasledujuca podmnienka je docasna a je len pre echo-msz a rodinapp
if ($row->password == 'chyba') {
if (md5($password) != $row->password) {
throw new Nette\Security\AuthenticationException("Invalid login name or password. Chybné meno alebo heslo.", self::INVALID_CREDENTIAL);
} else {
$this->PasswordHash(8, FALSE);
//Nastavenie
$new_password = $this->HashPassword($row->password);
$this->database->table('users')->get($row->id)->update(array('password' => $new_password, 'old_pass' => NULL, 'last_ip' => $this->context->httpRequest->getRemoteAddress()));
}
} else {
if (!$this->CheckPassword($password, $row->password)) {
throw new Nette\Security\AuthenticationException("Invalid login name or password. Chybné meno alebo heslo.", self::INVALID_CREDENTIAL);
}
}
//data z tabulky user_profiles
$prof1 = $this->database->table('user_profiles')->where(array('id_users' => $row->id))->limit(1)->fetch();
//login ok
$this->database->table('user_prihlasenie')->insert(array('id_user_profiles' => $prof1->id, 'prihlasenie_datum' => StrFTime("%Y-%m-%d %H:%M:%S", Time())));
// unset($row->password);
$uzivatel = $row->toArray();
//data z tabulky users
$prof = $prof1->toArray();
unset($prof['id'], $prof['id_users']);
unset($uzivatel['id'], $uzivatel["password"]);
$uzivatel = array_merge($prof, $uzivatel);
// Zlucenie users a user_profiles
$nastav = array('pocet_pr' => $prof1->pocet_pr + 1, 'prihlas_teraz' => StrFTime("%Y-%m-%d %H:%M:%S", Time()), 'prihlas_predtym' => $prof1->prihlas_teraz);
//Docasne riadky
if (isset($row->created) && $prof1->created == NULL) {
$nastav['created'] = $row->created;
}
if (isset($row->modified) && $prof1->modified == NULL) {
$nastav['modified'] = $row->modified;
}
//Koniec Docasne riadky
$this->database->table('user_profiles')->get($prof1->id)->update($nastav);
return new Nette\Security\Identity($row->id, $prof1->registracia->role, $uzivatel);
}
示例15: Login
static public function Login($user_id=0) {
global $INI; if ($INI['credit']['login']==0) return ;
$now = Time() - 86400;
$condition = array(
'user_id' => $user_id,
'action' => 'login',
"create_time > $now",
);
$count = Table::Count('credit', $condition);
if ($count>0) return;
self::Create($INI['credit']['login'], $user_id, 'login');
}