本文整理匯總了PHP中Reply::validate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reply::validate方法的具體用法?PHP Reply::validate怎麽用?PHP Reply::validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Reply
的用法示例。
在下文中一共展示了Reply::validate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionReply
public function actionReply()
{
$model = new Reply();
// uncomment the following code to enable ajax-based validation
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='reply-reply-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
$insert = new Compose();
if (isset($_POST['Reply'])) {
$subject = Yii::app()->user->getState('subject');
$email = Yii::app()->user->getState('email');
$body = $_POST['Reply']['body'];
$date = DATE('Y:M:D');
$insert->subject = $subject;
$insert->email = $email;
$insert->body = $_POST['Reply']['body'];
$insert->date = DATE("Y-m-d H+6:i:s");
$insert->save();
mail($email, $subject, $date, $body);
$this->render('mails');
$model->attributes = $_POST['Reply'];
exit;
if ($model->validate()) {
// form inputs are valid, do something here
return;
}
}
$this->render('reply', array('model' => $model));
}