本文整理匯總了PHP中HttpRequest::IP方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpRequest::IP方法的具體用法?PHP HttpRequest::IP怎麽用?PHP HttpRequest::IP使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::IP方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Insert
function Insert()
{
if (jf::$RunMode->IsCLI()) {
return false;
}
$res = jf::SQL("INSERT INTO {$this->TablePrefix()}stats (UserID,SessionID,Timestamp,Page,Query,IP,Host,Protocol,UserAgent) VALUES\n\t\t\t(?,?,?,?,?,?,?,?,?)", jf::CurrentUser() ?: 0, jf::$Session->SessionID(), jf::time(), HttpRequest::URI(), HttpRequest::QueryString(), HttpRequest::IP(), HttpRequest::Host(), HttpRequest::Protocol(), HttpRequest::UserAgent());
return $res;
}
示例2: CreateSession
/**
Creates a new session for current visitor.
*/
function CreateSession()
{
return jf::SQL("INSERT INTO {$this->TablePrefix()}session (UserID,SessionID,LoginDate,LastAccess,IP,CurrentRequest) VALUES (?,?,?,?,?,?)", 0, $this->SessionID(), jf::time(), jf::time(), HttpRequest::IP(), "");
}
示例3: testIpAddress
public function testIpAddress()
{
$this->assertTrue((bool) filter_var(HttpRequest::IP(), FILTER_VALIDATE_IP), 'Function does not return IP address.');
}