错误500 Yii框架PHP

时间:2017-07-05 13:01:41

标签: php yii

我经常面对这个错误 "错误500数组到字符串转换"。需要帮助的人

JS控制器功能

$scope.saveSchool=function(){
    $http.post($scope.SchoolCTRLUrl+"/saveSchool" , $scope.schoolObject)
        .success(function(responce){


        })
};

行动方法

public function actionsaveSchool()
{
    $school = file_get_contents("php://input");
    $schoolInfo=json_decode($school,true);
    $schoolTable=new SchoolTable();
    $schoolTable->school_name=$schoolInfo["schoolName"];
    $schoolTable->registration_code=$schoolInfo["registrationCode"];
    $schoolTable->cell_no=$schoolInfo["cellNo"];
    $schoolTable->phone_no=$schoolInfo["phoneNo"];
    $schoolTable->logo=$schoolInfo["logo"];
    $schoolTable->email_address=$schoolInfo["emailAddress"];
    $schoolTable->contact_person=$schoolInfo["contactPerson"];
    $schoolTable->address=$schoolInfo["address"];
    $schoolTable->city=$schoolInfo["city"];
    $schoolTable->district=$schoolInfo["district"];
    $schoolTable->province=$schoolInfo["province"];
    if($schoolTable->save()) {
        $id = $schoolTable->school_id;
        echo $id;
    } else{
        echo $schoolTable->getErrors();
    }
}

1 个答案:

答案 0 :(得分:0)

请更改此行:

echo $ schoolTable-> getErrors(); 有了这个:

的print_r($ schoolTable-> getErrors());