本文整理汇总了PHP中Options::group方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::group方法的具体用法?PHP Options::group怎么用?PHP Options::group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($option, $value = '', $type = false, $group = false)
{
if ($option !== '') {
if ($group == false) {
$group = Options::group($option);
}
if ($type == false) {
$type = Options::type($option);
}
$db = Database::getDatabase();
$db->query('REPLACE INTO options (`key`, `value`, `type`, `group`) VALUES (:key:, :value:, :type:, :group:)', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
return $db->affectedRows();
} else {
return false;
}
}
示例2: add
public static function add($option, $value = '', $type = false, $group = false)
{
$db = Database::getDatabase();
/*if ($value == '') $value = Options::value($option);*/
if ($type == false) {
$type = Options::type($option);
}
if ($group == false) {
$group = Options::group($option);
}
if (Options::exists($option)) {
$db->query('UPDATE
options
SET
`value`=:value:, `type`=:type:, `group`=:group:
WHERE
`key`=:key:', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
/*echo "Update option";*/
} else {
$db->query('INSERT INTO
options
(`key`, `value`, `type`, `group`)
VALUES
(:key:, :value:, :type:, :group:)', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
/*echo "Inserted new option";*/
}
return $db->affectedRows();
}