本文整理汇总了PHP中FB::setSessionUser方法的典型用法代码示例。如果您正苦于以下问题:PHP FB::setSessionUser方法的具体用法?PHP FB::setSessionUser怎么用?PHP FB::setSessionUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FB
的用法示例。
在下文中一共展示了FB::setSessionUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: m
$user = null;
// get a user from the session
if ($facebookID = array_val($_SESSION, 'facebookID')) {
// will throw an exception if invalid
$user = m('user', $facebookID);
}
// a user called from the wib NAL, will throw an exception if invalid
if ($wib_session_user_id = array_val($_REQUEST, 'wib_session_user')) {
$user = m($wib_session_user_id);
}
// if we are logged in then set some useful defines and setup some other classes
if ($user) {
define('CURRENT_UID', $user->getID());
define('CURRENT_SESSION_KEY', $user->get_facebook_token());
// were going to call facebook using this users session
FB::setSessionUser($user);
// tell wib client who the active user is
WIB::setSessionUser($user);
} else {
define('CURRENT_UID', NULL);
define('CURRENT_SESSION_KEY', NULL);
}
/**
* the HTTP/HTML Template Handler & Presentation Layer (the view in mvc)
*/
require 'view.php';
// we are serving templates out of this folder
Template::setTemplatePath(CORE_PATH . 'view/');
// we are serving templates out of this folder
Template::setLayoutPath(SITE_ROOT . 'htdoc/layout/');
// the uri to target the controller
示例2: define
<?php
// test root directory
define('TEST_ROOT', realpath(dirname(__FILE__) . '/../') . '/');
// include the core for the framework
require TEST_ROOT . 'core/header.php';
// http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html
require_once 'PHPUnit/Framework.php';
// include our wrapper "test" for the PHPUnit_Framework_TestCase
require 'test.php';
// the MVC requires a view class, this view captures the changes so we can write unit tests
require 'view.php';
// craig's user
$test_user = m('user', 507521266);
// for tests that require a users is logged in
Test::setUser($test_user);
// were going to call facebook using this users session
FB::setSessionUser($test_user);
// tell wib client who the active user is
WIB::setSessionUser($test_user);