本文整理汇总了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));
}