本文整理汇总了PHP中Variable::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::save方法的具体用法?PHP Variable::save怎么用?PHP Variable::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Variable();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Variable'])) {
$model->attributes = $_POST['Variable'];
if ($model->save()) {
$this->redirect(array('admin'));
}
//$this->redirect(array('view','id'=>$model->id));
}
$this->render('create', array('model' => $model));
}
示例2: prepareData
public function prepareData()
{
$site = new Site();
$site->site_id = 1;
$site->site_domain = 'site1';
$site->save();
$site = new Site();
$site->site_id = 2;
$site->site_domain = 'site2';
$site->save();
$var = new Variable();
$var->variable_id = 1;
$var->variable_name = 'var1';
$var->save();
$var = new Variable();
$var->variable_id = 2;
$var->variable_name = 'var2';
$var->save();
$varval = new SiteVarvalue();
$varval->site_id = 1;
$varval->variable_id = 1;
$varval->varvalue_value = 'val1 dom1 var1';
$varval->save();
$varval = new SiteVarvalue();
$varval->site_id = 1;
$varval->variable_id = 2;
$varval->varvalue_value = 'val2 dom1 var2';
$varval->save();
$varval = new SiteVarvalue();
$varval->site_id = 2;
$varval->variable_id = 1;
$varval->varvalue_value = 'val3 dom2 var1';
$varval->save();
$varval = new SiteVarvalue();
$varval->site_id = 2;
$varval->variable_id = 2;
$varval->varvalue_value = 'val4 dom2 var2';
$varval->save();
}
示例3: defineFields
public function defineFields($id)
{
$bladetemp = $this->bladetemp->findOrFail($id);
$file = $bladetemp->file;
$fullpath = app_path() . '/views/uploads/' . $file;
$string = file_get_contents($fullpath);
$string = str_replace('{{', '|{{', $string);
$strings = explode('|', $string);
$pattern = "/{{(.*?)}}/";
//print_r($strings);
foreach ($strings as $string) {
if (preg_match($pattern, $string, $matches)) {
$variable = new Variable();
$var_title = substr($matches[1], strpos($matches[1], '"') + 2);
$variable->name = str_replace('"', '', $var_title);
echo $variable->name;
$variable->t_id = $id;
$variable->save();
//print_r($matches);
}
}
return Redirect::route('variables.assigntypes', array('id' => $id));
}