本文整理汇总了PHP中Rule::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Rule::save方法的具体用法?PHP Rule::save怎么用?PHP Rule::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rule
的用法示例。
在下文中一共展示了Rule::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* second sequence
* Method untuk menyimpan data rule dan menampilkan form rule
*/
public function actionCreate()
{
$model = new Rule();
if (isset($_POST['Rule'])) {
$model->attributes = $_POST['Rule'];
if ($model->validate() && $model->save()) {
echo CJSON::encode(array('status' => 'success', 'message' => 'Data rule has been saved successfully'));
} else {
$error = CActiveForm::validate($model);
if ($error != '[]') {
echo $error;
}
}
Yii::app()->end();
}
$this->renderPartial('_form', array('model' => $model, false, true));
}
示例2: array
// we posted . characters, but something converts them to _ (HTTP 1.1 standard)
$r = array();
foreach ($_REQUEST as $i => $v) {
$r[join('.', explode('_', $i))] = $v;
//convert _ back to .
}
$source = @$r['0'];
$target = @$r['1'];
$overtredingen = array();
for ($i0 = 0; isset($r['2.' . $i0]); $i0++) {
$overtredingen[$i0] = @$r['2.' . $i0 . ''];
}
$uitleg = @$r['3'];
$pattern = @$r['4'];
$Rule = new Rule($ID, $source, $target, $overtredingen, $uitleg, $pattern);
if ($Rule->save() !== false) {
die('ok:' . serviceref($_REQUEST['content']) . '&Rule=' . urlencode($Rule->getId()));
} else {
die('Please fix errors!');
}
exit;
// do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
$new = true;
} else {
$new = false;
}
if (isset($_REQUEST['edit']) || $new) {
$edit = true;