2017 © Pedro Peláez
 

library validation

image

jsnlib/validation

  • Wednesday, April 18, 2018
  • by fdjkgh580
  • Repository
  • 1 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

jsnlib-validation

簡單辨識是否有輸入參數到 function 的方法, (*1)

範例

function my($param)
{
    if (\Jsnlib\Validation::no_input($param->age))
        throw new \Exception("缺少參數 age");
}

若有帶入參數

\Jsnlib\Validation::input($data)
\Jsnlib\Validation::input($data, ['string_empty' => false])

若無帶入參數

\Jsnlib\Validation::no_input($data)
\Jsnlib\Validation::no_input($data, ['string_empty' => false])

通過有填寫參數的規則如下:, (*2)

O) TRUE
O) FALSE
X) NULL
X) (string)''
O) (int)0
O) (float)0.5
O) (int)-1
O) (int)1
O) (string)'1'
O) (string)'0'
O) (object) Class, (*3)

若將 string_empty 設定為 true,將會允許(string)''認定為通過。, (*4)

The Versions

18/04 2018

dev-master

9999999-dev https://github.com/fdjkgh580/validation.git

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

18/04 2018

1.1.2

1.1.2.0 https://github.com/fdjkgh580/validation.git

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

18/04 2018

1.1.1

1.1.1.0 https://github.com/fdjkgh580/validation.git

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

08/08 2017
08/08 2017