本文整理汇总了PHP中Social::google方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::google方法的具体用法?PHP Social::google怎么用?PHP Social::google使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Social
的用法示例。
在下文中一共展示了Social::google方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogin
public function getLogin($social)
{
try {
switch ($social) {
case 'facebook':
$su = \Social::facebook('user');
break;
case 'google':
$su = \Social::google('user');
break;
default:
$su = null;
}
if ($su === null) {
return \Redirect::route('frontend.index');
}
$m = \Member::where('uid', '=', $su->id)->where('social', '=', $social)->first();
if ($m == null) {
$m = new \Member();
$m->uid = $su->id;
$m->social = $social;
$m->name = $su->name;
$m->email = $su->email;
if ($social == 'facebook') {
if (isset($su->birthday)) {
$m->birthday = date('Y-m-d', strtotime($su->birthday));
}
if (isset($su->gender)) {
$m->gender = substr($su->gender, 0, 1);
}
}
$m->save();
}
// register user into Auth that is a global variable
\Auth::login($m);
return \Redirect::route('frontend.index');
} catch (Exception $e) {
echo $e->getMessage();
exit;
}
}
示例2: Social
<?php
/*-----------------------------------------------------------------------------------
File contains the Google signin + after signin close window
-------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------
START Google signin process
-------------------------------------------------------------------------------------*/
require 'google.php';
$GOOGLE = new Social();
if (isset($_GET['google'])) {
$GOOGLE->google();
}
?>
<!-- after authentication close the popup -->
<script type="text/javascript">
window.close();
</script>
<?php
/*-----------------------------------------------------------------------------------
END Google signin
-------------------------------------------------------------------------------------*/