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