duanfu3884 2018-07-31 08:01
浏览 39
已采纳

运行我的PHP脚本时意外的elseif

I don't really know what to do. Help would be much appreciated! Thank you.

function handleVerChk($arrData, Client $objClient){
    $objClient->sendData('<msg t="sys"><body action="apiOK" r="0"></body></msg>');
}

function handleLogin($arrData, Client $objClient){
    $strUser = $arrData['body']['login']['nick'];
    $strPass = $arrData['body']['login']['pword'];
    Silk\Logger::Log('Client is attempting to login with username \'' . $strUser . '\'');
    $blnExist = $this->objDatabase->playerExists($strUser);
    if($blnExist === false){
        $objClient->sendError(100);
        return $this->removeClient($objClient->resSocket);{
        elseif($arrUser["Banned"] == 1)
$objClient->sendError(603);
return $this->removeClient($objClient->resSocket);
        }
    }
  • 写回答

1条回答 默认 最新

  • douyingmou1389 2018-07-31 08:05
    关注

    Change your function to this you have some errors

    function handleLogin($arrData, Client $objClient){
        $strUser = $arrData['body']['login']['nick'];
        $strPass = $arrData['body']['login']['pword'];
        Silk\Logger::Log('Client is attempting to login with username \'' . $strUser . '\'');
        $blnExist = $this->objDatabase->playerExists($strUser);
        if($blnExist === false){
            $objClient->sendError(100);
            return $this->removeClient($objClient->resSocket);
        } elseif($arrUser["Banned"] == 1){
           $objClient->sendError(603);
           return $this->removeClient($objClient->resSocket);
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?