Php 无法从类函数调用中获取返回的布尔值

Php 无法从类函数调用中获取返回的布尔值,php,Php,我无法从php函数调用中获取返回值 ... $dey=$validate->yoxla($this->ad,$this->soyad,$this->istadi,$this->sifre,$this->email); if($dey){ // i cant get returned value from here. even it is true. ech

我无法从php函数调用中获取返回值

            ...
            $dey=$validate->yoxla($this->ad,$this->soyad,$this->istadi,$this->sifre,$this->email);

            if($dey){ // i cant get returned value from here. even it is true.
                echo 'asd';
                if(!$checkuser->checkusername($this->istadi)){
                    $err=array();
                    $err['code']='code14';
                    $err['aciglama']=$code14;
                    print json_encode($err);
                    die();
                }elseif(!$checkuser->checkemail($this->email)){
                    $err=array();
                    $err['code']='code15';
                    $err['aciglama']=$code15;
                    print json_encode($err);
                    die();
                }else{
                    $err=array();
                    $err['code']='acig';
                    print json_encode($err);
                    die();
                }
            }
yoxla()函数:

        ...
        elseif (!preg_match("/^.*(?=.{8,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/", $sifre)){
            $err=array();
            $err['code']='code11';
            $err['aciglama']=$code11;
            print json_encode($err);
            die();
        }elseif($email==""){
            $err=array();
            $err['code']='code12';
            $err['aciglama']=$code12;
            print json_encode($err);
            die();
        }elseif (!$this->validEmail($email)) {
            $err=array();
            $err['code']='code13';
            $err['aciglama']=$code13;
            print json_encode($err);
            die();
        }else{
            return true;
        }
我通过ajax请求调用第一个。并且没有任何东西返回到ajax,或者我无法从getresult()函数中获取返回值

从类声明中删除():

试试这个:

class Form{
   public function getresult(){
       return true;
   }
}

$validate=new Form();    
$result=$validate->getresult();

if($result){ 
    echo 'true';
}else{
    echo 'false';
}

启用php错误日志记录,以便您能够在浏览器上理解此类错误:

您应该第一次发布正确的代码,现在答案与问题不匹配。对不起,这是我的错(您可以创建一个新问题,因为现在此答案无效):\