本文整理匯總了PHP中models\User::retrieve_by_token方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::retrieve_by_token方法的具體用法?PHP User::retrieve_by_token怎麽用?PHP User::retrieve_by_token使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::retrieve_by_token方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: hackable_create
public function hackable_create()
{
$args = $this->request->args;
$token = $_COOKIE['user_token'];
$user = User::retrieve_by_token(Validate::token($token));
$username = $user->username;
$total = Validate::udouble($args['total']);
$products = $args['products'];
foreach ($products as $id => $quantity) {
Product::decrease_quantity(Validate::uint($id), Validate::uint($quantity));
}
$order = Order::create($username, $total);
$this->response->set_header(Lib\Response::HTTP_CREATED);
$this->response->set('order', $order);
}
示例2: remove_token
public function remove_token()
{
$args = $this->request->args;
$user = User::retrieve_by_token(Validate::token($args['token']));
$user->remove_token();
}