本文整理匯總了PHP中Factory::CreateAPI方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::CreateAPI方法的具體用法?PHP Factory::CreateAPI怎麽用?PHP Factory::CreateAPI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Factory
的用法示例。
在下文中一共展示了Factory::CreateAPI方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dirname
<?php
/**
* 獲取第三方驗證碼
* @author 潘洪學 panliu888@gmail.com
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '../init.php';
Passport::RequireLogin();
$api = Factory::CreateAPI($_GET['t'], $_GET['pid']);
ob_clean();
$api->showCode();
ob_end_flush();
示例2: dirname
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '../init.php';
switch ($_GET['error']) {
case 'login_denied':
echo <<<HTML
<script>
window.close();
</script>
HTML;
exit;
break;
}
if (!Passport::IsLogin()) {
redirect('../login.php?return_url=' . urlencode($_SERVER['REQUEST_URI']));
}
$pid = intval($_GET['pid']);
$api = Factory::CreateAPI($_GET['t'], $pid);
switch ($api->type) {
case 'qzone':
$code_key = 'oauth_vericode';
break;
case 'renren':
case 'sina':
$code_key = 'code';
break;
default:
$code_key = 'oauth_verifier';
break;
}
$token = $api->getAccessToken($_GET[$code_key], $_GET['oauth_token']);
if ($token['oauth_token']) {
$api->openid = $token['openid'];
示例3: dirname
<?php
/**
* 跳轉到開放平台登錄地址,RequestToken
* @author 潘洪學 panliu888@gmail.com
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '../init.php';
Passport::RequireLogin();
$type = $_GET['t'];
$pid = intval($_GET['pid']);
$api = Factory::CreateAPI($type, $pid);
// 獲取開放平台登錄地址,跳轉
switch ($api->type) {
case 'kx001':
$scope = 'send_feed create_records create_diary';
break;
case 'renren':
$scope = 'admin_page publish_blog';
break;
}
$cross = get_absolute_url('cross.php');
$auth_url = $api->GetAuthorizationUrl(get_absolute_url("bind.php?t={$type}&pid={$pid}&redir={$cross}", $api->callback), $scope);
if (start_with($auth_url, 'http')) {
redirect($auth_url);
} else {
echo $auth_url;
}