本文整理汇总了PHP中Variable::maj方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::maj方法的具体用法?PHP Variable::maj怎么用?PHP Variable::maj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable::maj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: foreach
require_once "pre.php";
require_once "auth.php";
if (!isset($action)) {
$action = "";
}
if (!est_autorise("acces_configuration")) {
exit;
}
if ($action == "modifier") {
if (is_array($_REQUEST['valeur'])) {
foreach ($_REQUEST['valeur'] as $id => $valeur) {
$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);
示例3: 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();
}
}