本文整理汇总了PHP中MessageManager::getPublicKeyForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageManager::getPublicKeyForUser方法的具体用法?PHP MessageManager::getPublicKeyForUser怎么用?PHP MessageManager::getPublicKeyForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageManager
的用法示例。
在下文中一共展示了MessageManager::getPublicKeyForUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ErrorMessage
$user = $usertool->getUserByToken($token);
if ($user != NULL) {
echo $usertool->getUsernames();
} else {
$error = new ErrorMessage("The access token is wrong!");
echo json_encode($error);
}
});
$app->get('/api/user/:username/public_key', function ($username) use($app) {
$auth = $app->request->headers->get('Authorization');
$token = substr($auth, 6);
$usertool = new UserTool();
$messagemanager = new MessageManager();
$user = $usertool->getUserByToken($token);
if ($user != NULL) {
echo $messagemanager->getPublicKeyForUser($username);
} else {
$error = new ErrorMessage("The access token is wrong!");
echo json_encode($error);
}
});
//section for retrieve inbox messages
$app->get('/api/inbox', function () use($app) {
$auth = $app->request->headers->get('Authorization');
$token = substr($auth, 6);
$usertool = new UserTool();
$messagemanager = new MessageManager();
$user = $usertool->getUserByToken($token);
if ($user != NULL) {
echo $messagemanager->getMessagesForUser($user->id);
} else {