本文整理汇总了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