Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

鍙傛暟鏍¢獙

鍦"鍙傛暟缁戝畾"鏃讹紝璧峰宸茬粡鏀寔浜嗕袱椤瑰熀鏈殑鏍¢獙锛堢被鍨嬪拰鏄惁蹇呴夛級锛屽鏋滆鏀寔鏇村鏉傜殑鏍¢獙瑙勫垯锛屽彲浠ラ氳繃 @v 鎸囧畾锛屽锛

/**
 * @route GET /books/
 * @param int $offsit {@v min:0}
 * @param int $limit {@v min:1|max:100}
 */
public function getBooks($offsit=0, $limit=10)

1. 璇硶

@v <rule>[:param0[,param1...]][|<rule2>...]

  • 澶氫釜瑙勫垯闂寸敤|鍒嗗壊銆
  • 瑙勫垯鍜屽叾鍙傛暟闂寸敤:鍒嗗壊, 濡傛灉鏈夊涓弬鏁帮紝鍙傛暟闂寸敤,鍒嗗壊銆

2. 鏀寔鐨勮鍒

  • required - Required field
  • equals - Field must match another field (email/password confirmation)
  • different - Field must be different than another field
  • accepted - Checkbox or Radio must be accepted (yes, on, 1, true)
  • numeric - Must be numeric
  • integer - Must be integer number
  • boolean - Must be boolean
  • array - Must be array
  • length - String must be certain length
  • lengthBetween - String must be between given lengths
  • lengthMin - String must be greater than given length
  • lengthMax - String must be less than given length
  • min - Minimum
  • max - Maximum
  • in - Performs in_array check on given array values
  • notIn - Negation of in rule (not in array of values)
  • ip - Valid IP address
  • email - Valid email address
  • url - Valid URL
  • urlActive - Valid URL with active DNS record
  • alpha - Alphabetic characters only
  • alphaNum - Alphabetic and numeric characters only
  • slug - URL slug characters (a-z, 0-9, -, _)
  • regex - Field matches given regex pattern
  • date - Field is a valid date
  • dateFormat - Field is a valid date in the given format
  • dateBefore - Field is a valid date and is before the given date
  • dateAfter - Field is a valid date and is after the given date
  • contains - Field is a string and contains the given string
  • creditCard - Field is a valid credit card number
  • optional - Value does not need to be included in data array. If it is however, it must pass validation.