本文整理汇总了PHP中Time::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::get方法的具体用法?PHP Time::get怎么用?PHP Time::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
public static function Create($Company = 1, $State = 1, $CustomRef = false)
{
$referenceKey = $CustomRef != false ? $CustomRef : \Hash::salt(6);
if (count(\DB::getInstance()->table("keys")->where("key", $referenceKey)) == 0) {
$key = \DB::getInstance()->table("keys")->insert(array("key" => $referenceKey, "companyID" => $Company, "state" => $State, "timeSent" => \Time::get()));
return $referenceKey;
}
return -1;
}
示例2: Create
public static function Create($Key = 0, $Company = false)
{
$Return = false;
if ($Key !== 0) {
if (\Session::exists("refKey")) {
if (\Session::get("refKey") != $Key) {
//This computer has multiple Keys? I'm not sure how or why this would happen.
//It is a possibility so I guess I should probably plan for it
$SavedKey = new Key(\Session::get("refKey"));
if ($SavedKey->validKey()) {
//Has two valid keys? What on earth? I will have to account for this later
} else {
\Session::put("refKey", $Key);
$Return = true;
}
}
} else {
\Session::put("refKey", $Key);
$Return = true;
}
if (\Cookie::exists("refKey")) {
if (\Cookie::get("refKey") != $Key) {
$SavedKey = new Key(\Cookie::get("refKey"));
if ($SavedKey->validKey()) {
//Has two valid keys? What on earth? I will have to account for this later
} else {
\Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
$Return = true;
}
}
} else {
\Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
$Return = true;
}
if ($Company != false) {
if (count(\DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->where("Company", $Company->ID())) == 0) {
\DB::getInstance()->table("companyip")->insert(array("IP" => \Connection::IP(), "Company" => $Company->ID(), "LastScene" => \Time::get(), "Hits" => 1));
} else {
\DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->increment("Hits");
}
}
//IP Based Search will go here
return $Return;
}
return false;
}
示例3: shouldTrack
protected function shouldTrack()
{
if (Session::exists(Config::get("session/session_name"))) {
//Are they logged in?
$this->reason = "Authenticated";
return false;
}
if (Session::exists("LastVisited")) {
/*
We don't want to track the user every time they open a page but rather every time they
open the site To achieve this we will only record the first page load every ten minutes
*/
//----------- Currently 1 for testing -----------//
if (Time::get() - Session::get("LastVisited") < 1) {
$this->reason = "Last Visit";
return false;
}
}
return true;
}
示例4: Create
public static function Create(array $Data = array())
{
$Data["timeSent"] = \Time::get();
$ID = \DB::getInstance()->table("company")->insertGetId($Data);
return $ID;
}
示例5: testSetTimeZone
/**
* Tests the setTimezone() method.
*
* @see \Jyxo\Time\Time::setTimezone()
*/
public function testSetTimeZone()
{
$time = Time::get(time(), 'UTC');
$this->assertNotSame('Europe/Prague', $time->getTimeZone()->getName());
$time->setTimeZone('Europe/Prague');
$this->assertSame('Europe/Prague', $time->getTimeZone()->getName());
$timeZone = new \DateTimeZone('America/Santiago');
$time->setTimeZone($timeZone);
$this->assertSame('America/Santiago', $time->getTimeZone()->getName());
// Invalid timezone
try {
$time->setTimeZone('Foo/Bar');
$this->fail('Expected exception \\InvalidArgumentException.');
} catch (\PHPUnit_Framework_AssertionFailedError $e) {
throw $e;
} catch (\Exception $e) {
// Correctly thrown exception
$this->assertInstanceOf('\\InvalidArgumentException', $e);
}
}