0

Laravel exception 'ReflectionException' with message 'Class validator does not exist' in

prudence created at6 years ago view count: 2355

Laravel 不能使用Validator。

# app/Providers/AppServiceProvider.php
    public function boot()
    {

        Validator::extend('cellphone', function($attribute, $value, $parameters, $validator) {
            return preg_match('/^1\d{10}$/', $value);
        });

    }

报错

exception 'ReflectionException' with message 'Class validator does not exist' in

report
回复
0

把这个代码在BaseController里面调用下。上次也是遇到这个问题,没有找到原因。

6 years ago 回复