本文整理匯總了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();
}
}