首页 > 解决方案 > 运行我的php脚本时出现意外的elseif

问题描述

我真的不知道该怎么办。帮助将不胜感激!谢谢你。

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);
        }
    }

标签: phplinuxserver

解决方案


将您的功能更改为此您有一些错误

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);
    }
}

推荐阅读