当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Validate_Between::getMessages方法代码示例

本文整理汇总了PHP中Zend_Validate_Between::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Between::getMessages方法的具体用法?PHP Zend_Validate_Between::getMessages怎么用?PHP Zend_Validate_Between::getMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Validate_Between的用法示例。


在下文中一共展示了Zend_Validate_Between::getMessages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: betweenAction

 public function betweenAction()
 {
     $v = new Zend_Validate_Between(array('min' => 1, 'max' => 12));
     $valor = 15;
     if ($v->isValid($valor)) {
         echo "{$valor} eh valido";
     } else {
         echo "{$valor} eh invalido";
         $erros = $v->getMessages();
         print_r($erros);
     }
     exit;
 }
开发者ID:JoaoAntonioMaruti,项目名称:AulasUnipar2015,代码行数:13,代码来源:ValidadorController.php

示例2: setHits

 /**
  * set the max result hits for this search
  *
  * @param integer $hits
  * @return Zend_Service_DeveloperGarden_LocalSearch_SearchParameters
  */
 public function setHits($hits = 10)
 {
     require_once 'Zend/Validate/Between.php';
     $validator = new Zend_Validate_Between(0, 1000);
     if (!$validator->isValid($hits)) {
         $message = $validator->getMessages();
         require_once 'Zend/Service/DeveloperGarden/LocalSearch/Exception.php';
         throw new Zend_Service_DeveloperGarden_LocalSearch_Exception(current($message));
     }
     $this->_parameters['hits'] = $hits;
     return $this;
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:18,代码来源:SearchParameters.php

示例3: setImgSize

 /**
  * Sets img size
  *
  * @throws Zend_View_Exception
  * @param int $imgSize Size of img must be between 1 and 512
  * @return Zend_View_Helper_Gravatar
  */
 public function setImgSize($imgSize)
 {
     /**
      * @see Zend_Validate_Between
      */
     require_once 'Zend/Validate/Between.php';
     $betweenValidate = new Zend_Validate_Between(1, 512);
     $result = $betweenValidate->isValid($imgSize);
     if (!$result) {
         /**
          * @see Zend_View_Exception
          */
         require_once 'Zend/View/Exception.php';
         throw new Zend_View_Exception(current($betweenValidate->getMessages()));
     }
     $this->_options['imgSize'] = $imgSize;
     return $this;
 }
开发者ID:kminkov,项目名称:Blog,代码行数:25,代码来源:Gravatar.php

示例4: testSetGetMessageLengthLimitation

 public function testSetGetMessageLengthLimitation()
 {
     Zend_Validate::setMessageLength(5);
     $this->assertEquals(5, Zend_Validate::getMessageLength());
     $valid = new Zend_Validate_Between(1, 10);
     $this->assertFalse($valid->isValid(24));
     $message = current($valid->getMessages());
     $this->assertTrue(strlen($message) <= 5);
 }
开发者ID:netvlies,项目名称:zf,代码行数:9,代码来源:ValidateTest.php

示例5: testGetMessages

 /**
  * Ensures that getMessages() returns expected default value
  *
  * @return void
  */
 public function testGetMessages()
 {
     $validator = new Zend_Validate_Between(array('min' => 1, 'max' => 10));
     $this->assertEquals(array(), $validator->getMessages());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:10,代码来源:BetweenTest.php

示例6: setImgSize

 /**
  * Sets img size
  *
  * @throws Zend_View_Exception
  * @param int $imgSize Size of img must be between 1 and 512
  * @return Zwe_View_Helper_Gravatar
  */
 public function setImgSize($imgSize)
 {
     $betweenValidate = new Zend_Validate_Between(1, 512);
     $result = $betweenValidate->isValid($imgSize);
     if (!$result) {
         throw new Zend_View_Exception(current($betweenValidate->getMessages()));
     }
     $this->_options['imgSize'] = $imgSize;
     return $this;
 }
开发者ID:BGCX262,项目名称:zweer-gdr-svn-to-git,代码行数:17,代码来源:Gravatar.php

示例7: isValidDocument

 public function isValidDocument($file, $max, $allowedTypes)
 {
     //check size
     $validator = new Zend_Validate_Between('1', $max);
     if ($validator->isValid($file['size'])) {
     } else {
         // value failed validation; print reasons
         foreach ($validator->getMessages() as $message) {
             return array('Error' => 'Document:' . $message);
         }
     }
     //check the type
     $this->_fileName = $file['name'];
     $return = $this->_checkType($allowedTypes);
     if ($return == false) {
         return array('Error' => 'Non-allowed type of document.');
     }
 }
开发者ID:roycocup,项目名称:Tests,代码行数:18,代码来源:Validator.php


注:本文中的Zend_Validate_Between::getMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。