php - 运行我的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);
}
}
解决方案
将您的功能更改为此您有一些错误
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);
}
}
推荐阅读
- c# - Cassandra C#驱动程序手动分页不起作用
- python - Python,比较一个数字列表并不断循环,直到没有重复
- node.js - Rust 和 Wasm 初始设置
- python-2.7 - 将数据从文本文件保存到python中的CSV文件,分隔符为空格
- java - 如何在java中读取json数据并显示键值对的特定输出
- arrays - Mongodb查找比较来自同一数组的不同元素
- dtw - 如何从 dtw-python 库中约束 dtw?
- performance - Netlogo 从索引乌龟获取表值很慢
- .net-core - 如何编写可以从 appsettings.json 查找值的自定义 NLog 目标
- c++ - 尝试使用 OpenCV 从图像写入图像时出现 CL_INVALID_KERNEL_ARGS