scene($scene)->check($params); if (!$result) { throw new ValidateException(is_array($this->error) ? implode( ';', $this->error) : $this->error); }else{ return true; } } /** * 正整数验证 * @param $value * @param string $rule * @param string $data * @param string $field * @return bool|string */ protected function isPositiveInteger($value, $rule='', $data='', $field='') { if (is_numeric($value) && is_int($value + 0) && ($value + 0) > 0) { return true; } return $field . '必须是正整数'; } }