本文整理汇总了PHP中Variable::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::add方法的具体用法?PHP Variable::add怎么用?PHP Variable::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($nom, $valeur)
{
$this->nom = $nom;
$this->valeur = $valeur;
$this->protege = 0;
$this->cache = 0;
if ($this->nom !== "" && !self::testVariableExists($this->nom)) {
parent::add();
ActionsModules::instance()->appel_module("addvariable", new Variable($this->nom));
redirige("variable.php");
} else {
throw new TheliaAdminException("impossible to add new promo", TheliaAdminException::VARIABLE_ADD_ERROR, null, $this);
}
}
示例2: maj_variable
private function maj_variable($nom, $valeur)
{
$variable = new Variable();
if ($variable->charger($nom)) {
$variable->valeur = $valeur;
$variable->maj();
} else {
$variable->nom = $nom;
$variable->valeur = $valeur;
$variable->protege = 1;
$variable->cache = 1;
$variable->add();
}
}
示例3: Variable
$variable = new Variable();
if ($variable->charger_id($id)) {
if ($valeur != $variable->valeur) {
$variable->valeur = $valeur;
$variable->maj();
ActionsModules::instance()->appel_module("modvariable", $variable);
}
}
}
}
// Ajouter ?
$nom = lireParam('ajout_nom', 'string');
if ($nom != '') {
$variable = new Variable();
$variable->nom = $nom;
$variable->valeur = lireParam('ajout_valeur', 'string');
$variable->protege = 0;
$variable->cache = 0;
$variable->add();
ActionsModules::instance()->appel_module("addvariable", $variable);
}
} else {
if ($action == "supprimer") {
$variable = new Variable();
if ($variable->charger_id(intval(lireParam('id', 'int')))) {
$variable->delete();
}
ActionsModules::instance()->appel_module("delvariable", $variable);
}
}
redirige("variable.php");
示例4: ecrire
public static function ecrire($nom, $valeur, $creer_si_inexistante = false, $protege = 1, $cache = 1)
{
$var = new Variable($nom);
if ($creer_si_inexistante && !$var->charger($nom)) {
$var->nom = $nom;
$var->valeur = $valeur;
$var->protege = $protege;
$var->cache = $cache;
$var->add();
} else {
$var->valeur = $valeur;
$var->maj();
}
}