當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BaseController::validate方法代碼示例

本文整理匯總了PHP中BaseController::validate方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseController::validate方法的具體用法?PHP BaseController::validate怎麽用?PHP BaseController::validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BaseController的用法示例。


在下文中一共展示了BaseController::validate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validate

 public function validate($retType)
 {
     parent::validate($retType);
     copyArray($_POST, $v, '*');
     if (trim($v['username']) == '') {
         $rets[] = array('msg' => 'Please enter your username!', 'field' => 'username');
     }
     if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) {
         $rets[] = array('msg' => 'Invalid email address!', 'field' => 'email');
     }
     if ($v['password'] == '') {
         $rets[] = array('msg' => 'Please enter your password!', 'field' => 'password');
     }
     if (strlen($v['password']) < 3) {
         $rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password');
     }
     if ($v['password'] != $v['cpassword']) {
         $rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword');
     }
     if (isset($rets)) {
         if (isset($retType) && $retType == RT_JSON) {
             return outputJson($rets);
         } else {
             return $rets;
         }
     }
 }
開發者ID:renduples,項目名稱:alibtob,代碼行數:27,代碼來源:Register.php

示例2: validate

 public function validate($retType)
 {
     parent::validate($retType);
     copyArray($_POST, $fv, 'username');
     if (validateUsername($fv['username']) == false) {
         $rets[] = array('msg' => '<br/>Invalid username!', 'field' => 'username');
     }
     if (isset($rets)) {
         if (isset($retType) && $retType == RT_JSON) {
             return outputJson($rets);
         } else {
             return $rets;
         }
     }
 }
開發者ID:renduples,項目名稱:alibtob,代碼行數:15,代碼來源:SignIn.php

示例3: validate

	public function validate($retType)
	{
		copyArray($_POST, $v, '*');
		$rets = parent::validate($retType, $v);

		if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) {
    		$rets[] = array('msg' => 'Invalid email address!', 'field' => 'email', 'focus' => 'email');
        }
		if (strlen($v['password']) < 3) {
			$rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password', 'focus' => 'password');
		}
		if ($v['password'] != $v['cpassword']) {
			$rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword', 'focus' => 'cpassword');
		}

		if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets);
        return $rets;
	}
開發者ID:ngduc,項目名稱:Thin-PHP-Framework,代碼行數:18,代碼來源:Register.php

示例4: validate

 public function validate($retType)
 {
     parent::validate($retType);
     copyArray($_POST, $fv, 'name', 'email', 'content');
     if (trim($fv['name']) == '') {
         $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name');
     }
     if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) {
         $rets[] = array('msg' => 'Invalid email!', 'field' => 'email');
     }
     if (trim($fv['content']) == '') {
         $rets[] = array('msg' => 'Please enter content!', 'field' => 'content');
     }
     if (isset($rets)) {
         if (isset($retType) && $retType == RT_JSON) {
             return outputJson($rets);
         } else {
             return $rets;
         }
     }
 }
開發者ID:renduples,項目名稱:alibtob,代碼行數:21,代碼來源:BlogComment.php

示例5: validate

	public function validate($retType)
	{
		parent::validate($retType);

		copyArray($_POST, $fv, 'name', 'email', 'msg');

		if (trim($fv['name']) == '') {
			$rets[] = array('msg' => 'Please enter your name!', 'field' => 'name');
		}
		if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) {
    		$rets[] = array('msg' => 'Invalid email!', 'field' => 'email');
        }
        if (trim($fv['msg']) == '') {
			$rets[] = array('msg' => 'Please enter your message!', 'field' => 'msg');
		}
        if (ReCaptcha::checkAnswer() == false && isset($retType) && $retType == RT_JSON) {
        	$rets[] = array('msg' => 'The reCAPTCHA wasn\'t entered correctly!', 'field' => 'recaptcha');
        }

		if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets);
        return $rets;
	}
開發者ID:ngduc,項目名稱:Thin-PHP-Framework,代碼行數:22,代碼來源:ContactUs.php


注:本文中的BaseController::validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。