本文整理匯總了PHP中UserQuery::findPk方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserQuery::findPk方法的具體用法?PHP UserQuery::findPk怎麽用?PHP UserQuery::findPk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserQuery
的用法示例。
在下文中一共展示了UserQuery::findPk方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCurrentUser
public static function getCurrentUser()
{
if (self::checkIfAuthenticated()) {
$query = new UserQuery();
$user = $query->findPk($_SESSION[self::$SESSION_USER_ID]);
return $user;
} else {
return null;
}
}
示例2: UserQuery
<?php
if (!isset($_SESSION)) {
session_start();
}
if (isset($_SESSION['uid'])) {
//get user from uid
$q = new UserQuery();
$user = $q->findPk($_SESSION['uid']);
}
?>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<!-- these three spans are decoration for the expand button -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/RPIWannaHangOut/index.php">RPIWannaHangOut</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/RPIWannaHangOut/explore.php">Explore</a></li>
<?php