我收到一个 php 错误errors: [1]
0: {
message: "Undefined offset: 1 (Error Number: 8), (File: /Users/akashpatel/Documents/iOS development/RideShare/RideShareAPI/src/frapi/library/Frapi/Controller/Api.php at line 299)"
name: "PHP Notice error"
at: ""
}
。
下面是代码。
if (isset($_SERVER['HTTP_LOGIN']))
{
list($userId, $apiKey) = explode(':', base64_decode($_SERVER['HTTP_LOGIN']));
$this->setUserId($userId);
$this->setApiKey($apiKey);
//check against DB
$sql = "SELECT * from user WHERE id=:userId AND apiKey=:apiKey";
$stmt = $db->prepare($sql);
$stmt->bindParam(':userId', $this->getUserId());
$stmt->bindParam(':apiKey', $this->getApiKey());
try
{
$stmt->execute();
$user = $stmt->fetchObject();
}
catch(PDOException $err)
{
echo $err->getMessage();
}
if ($user == null)
throw new Frapi_Error('STATUS_FORBIDDEN');
}
else
{
$this->userName = false;
$this->apiKey = false;
throw new Frapi_Error(
Frapi_Error::ERROR_INVALID_ACTION_REQUEST_NAME,
Frapi_Error::ERROR_INVALID_ACTION_REQUEST_MSG,
Frapi_Error::ERROR_INVALID_ACTION_REQUEST_NO,
Frapi_Error::ERROR_INVALID_ACTION_REQUEST_HTTP_MSG
);
}
提前致谢。
编辑:
对不起大家。我传递了不正确的值。现在我使用正确的一个,但得到错误ERROR_INVALID_ACTION_REQUEST
。可能是因为它去了别的地方。但不明白可能是什么原因。我编辑了代码。