Browse Source

针对数字验证,增加有符号整形

Zhu Jinhui 7 năm trước cách đây
mục cha
commit
d975e95a3a
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/Library/Validate.php

+ 1 - 1
src/Library/Validate.php

@@ -340,7 +340,7 @@ class Validate
 	 */
 	public function number($str)
 	{
-		return preg_match("/^[0-9]+$/", $str);
+		return preg_match("/^(\-){0,1}[0-9]+$/", $str);
 	}
 
 	/**