本文整理匯總了PHP中Bar::ValidArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bar::ValidArray方法的具體用法?PHP Bar::ValidArray怎麽用?PHP Bar::ValidArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bar
的用法示例。
在下文中一共展示了Bar::ValidArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Bar constructor.
* @param Session $session
* @param string[] $barData
*/
public function __construct($session, $barData)
{
$this->Session = $session;
$this->DB = $session->DB;
if (empty(array_diff_key(Bar::ValidArray(), $barData))) {
//Loading an existing bar
$this->Refresh($barData);
$this->Valid = true;
} else {
if (empty(array_diff_key(Bar::NewArray(), $barData))) {
//Creating a new bar
$this->Type = $barData['type'];
$this->Title = $barData['title'];
$this->Description = $barData['description'];
$this->CreateStamp = $this->ModifyStamp = (double) microtime(true);
$id = (int) $this->DB->Query("\n INSERT INTO tblBars\n (userID, type, title, description, createStamp, modifyStamp)\n VALUES(\n " . (int) $this->Session->ID . "\n , " . $this->DB->Quote($this->Type) . "\n , " . $this->DB->Quote($this->Title) . "\n , " . $this->DB->Quote($this->Description) . "\n , {$this->CreateStamp}\n , {$this->ModifyStamp}\n )\n ", true);
if ($id) {
$this->ID = $id;
$this->Valid = true;
}
}
}
}