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