简体   繁体   English

找不到类别“ Respect \\ Validation \\ Validator”

[英]Class 'Respect\Validation\Validator' not found

Hello I really need help with this error I get when working with SLIM. 您好,我确实需要帮助处理SLIM时遇到的此错误。 I get this error: 我收到此错误:

Type: Error
Message: Class 'Respect\Validation\Validator' not found
File: /storage/content/90/223690/marbleuf.se/public_html/cart/app/Validation/Forms/OrderForm.php
Line: 12

Here is my code from OrderForm.php: 这是我来自OrderForm.php的代码:

<?php

namespace Cart\Validation\Forms;

use Respect\Validation\Validator as v;

class OrderForm
{
    public static function rules()
    {
        return [
            'email' => v::email(),
            'name' => v::alpha(' '),
            'address1' => v::alnum(' -'),
            'address2' => v::optional(v::alnum(' -')),
            'city' => v::alnum(' '),
            'postal_code' => v::alnum(' '),
        ];
    }
}

Based on my assumption your use statement should be the following 根据我的假设,您的使用声明应为以下内容

use Cart\Validation\Validator as v;

NOT

use Respect\Validation\Validator as v;

See this for reference (If I have the right code base) https://github.com/raniesantos/slim-cart/blob/master/app/Validation/Validator.php 请参阅此以供参考(如果我有正确的代码库) https://github.com/raniesantos/slim-cart/blob/master/app/Validation/Validator.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM