easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.73k stars 511 forks source link

验证器无法验证数组 #517

Open mengzhuowei opened 2 years ago

mengzhuowei commented 2 years ago

image image image

XueSiLf commented 2 years ago

好的,这边测试下。感谢反馈。

XueSiLf commented 2 years ago

这边测试是可以验证的啊,请您提供详细的调用代码。 这边测试是ok的。

<?php

require_once __DIR__ . '/vendor/autoload.php';

$validate = new \EasySwoole\Validate\Validate();

$validate->addColumn('inputs')->isArray('not array!');
$bool = $validate->validate([
    'inputs' => [
        [
            'address' => '1',
            'amount' => '2'
        ],
        [
            'address' => '3',
            'amount' => '4'
        ],
    ]
]);
var_dump($bool); // true
var_dump($validate->getError()); // NULL