如何解决这个错误。 $ this-> func()-> function();

时间:2019-10-26 10:24:57

标签: php

嗨,我很难像这样上课

$valid = $check->get_request_login("hi", "required | min: 3")->execute_validation();

你能帮我吗?以下是附加代码。

public function get_request_login($req = NULL, $method = NULL)
{

    $request = 
    [ 

        'password'  => $req,
        'method'    => $method

    ];
    return $request;

}

public function execute_validation($request)
{

    $data = array(

        'password' => $request['password']

    );
    $this->setMessages([
        'required'      => ':attribute harus diisi',
        'password:required'      => 'Password tidak boleh kosong'
        // etc
    ]);


    // make it
    $validation = $this->make($data + $_FILES, [
        'password'              => $request['method'],
    ]);




    // then validate
    $validation->validate();
    $errors = $validation->errors();


    if ($validation->fails()) {
        // handling errors
        $errors = $validation->errors();
        $messages = $errors->toArray(':message', true);
        echo "<pre>";
        print_r($messages);
        echo "</pre>";
        exit;
    } else {
        // validation passes
        echo "Success!";
    }

错误消息如下

  

致命错误:未捕获错误:在C:\ xampp \ htdocs \ index.php:57中的数组上调用成员函数execute_validation()堆栈跟踪:#0 {main}抛出在C:\ xampp \ htdocs \ index中.php行57

0 个答案:

没有答案