本文整理汇总了PHP中BigTree::apiEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::apiEncode方法的具体用法?PHP BigTree::apiEncode怎么用?PHP BigTree::apiEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigTree
的用法示例。
在下文中一共展示了BigTree::apiEncode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apiValidateToken
function apiValidateToken($token)
{
$t = sqlfetch(sqlquery("SELECT * FROM bigtree_api_tokens WHERE token = '{$token}'"));
if (!$t) {
echo BigTree::apiEncode(array("success" => false, "error" => "Token is invalid."));
return false;
}
if ($t["temporary"] && strtotime($t["expires"]) < time()) {
echo BigTree::apiEncode(array("success" => false, "error" => "Token has expired."));
return false;
}
// If it's a temporary token, update its expiration to keep it fresh.
if ($t["temporary"]) {
sqlquery("UPDATE bigtree_api_tokens SET expires = '" . date("Y-m-d H:i:s", strtotime("+30 minutes")) . "' WHERE id = '" . $t["id"] . "'");
}
$user = $this->getUser($t["user"]);
$this->ID = $user["id"];
$this->User = $user["email"];
$this->Level = $user["level"];
$this->Name = $user["name"];
$this->Permissions = $user["permissions"];
$this->ReadOnly = $t["read_only"];
return true;
}