本文整理汇总了PHP中auth::check_ticket方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::check_ticket方法的具体用法?PHP auth::check_ticket怎么用?PHP auth::check_ticket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::check_ticket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_permission
public static function check_permission($required)
{
global $ticket;
if ($ticket && auth::check_ticket($ticket, auth::get_seed())) {
list($uname, $role, $timestamp, $md5str) = explode(':', $ticket);
} else {
$role = ROLE_ANONYMOUS;
}
if ($role > $required) {
/*1为最大角色,其它权限依数字越大,权限越小*/
throw new ForbiddenException('permission denied');
}
}
示例2: array_push
array_push($ret, $params[$arg_name]);
} else {
if ($func_args[$i]->isOptional() || $func_args[$i]->isDefaultValueAvailable()) {
continue;
} else {
//echo "check_method_params 2:$arg_name\n";
return null;
}
}
}
return $ret;
}
/*check the ticket*/
$ticket = isset($_COOKIE["ticket"]) ? $_COOKIE["ticket"] : null;
$resobj = new response();
if ($ticket && !auth::check_ticket($ticket)) {
$resobj->set(array('code' => 403, 'body' => "ticket invalid!"));
goto RES_CLIENT;
}
/*extract a clean and standard path like /rest/xxx/xxx/xxx*/
function filter_path()
{
$path = preg_replace('/\\|\\\\|\\/\\//', '/', $_SERVER["REQUEST_URI"]);
$path = preg_replace('/\\?[^\\/]*$/', '', $path);
$path = preg_replace('/\\/$/', '', $path);
return $path;
}
/*find the api handler method*/
$handler = find_handler(filter_path());
if ($handler) {
$params = check_method_params($handler['method'], extract_params());