The example in this article describes the usage of jquery form validation plug-in in Yii framework. Share it with everyone for your reference, the details are as follows:
The running effect diagram is as follows:
View layer:
Controller (verify uniqueness):
//验证姓名唯一性 public function actionOnly(){ $u_name=Yii::$app->request->get('u_name'); $login=Yii::$app->db; //查询数据 $sql="select * from login where u_name='$u_name'"; $res=$login->createCommand($sql)->execute(); if($res) { echo false; } else { echo true; } }
I hope this article will be helpful Our PHP programming based on the Yii framework is helpful.
For more related articles about jquery form validation plug-in usage examples in the Yii framework, please pay attention to the PHP Chinese website!