Home  >  Article  >  Backend Development  >  jquery form validation plug-in usage example in Yii framework_php example

jquery form validation plug-in usage example in Yii framework_php example

WBOY
WBOYOriginal
2016-12-05 13:28:191085browse

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 operation 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;
  }
}

Readers who are interested in more Yii-related content can check out the special topics on this site: "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent PHP Development Framework", "Basic Tutorial for Getting Started with Smarty Templates", "Introduction to PHP Object-Oriented Programming" Tutorial", "php string (string) usage summary", "php+mysql database operation introductory tutorial" and "php common database operation skills summary"

I hope this article will help you design PHP programs based on the Yii framework.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn